JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

partition-by

core-api


    function
    boot.janet on line 2022, column 1

    (partition-by f x)

    Partition values of `x` by a function `f`. Partitions split when 
    `f` applied to a value changes result when iterating to the next 
    value of `x`. Returns a new array of arrays.

    `x` can be a bytes, indexed, fiber, or abstract type with suitable 
    `get` and `next` methods.


1 exampleSign in to add an example
Loading...
(partition-by even? [1 1 2 3 5 8 13 21])
# => @[@[1 1] @[2] @[3 5] @[8] @[13 21]]
sogaiuPlayground