JanetDocsPlaygroundI'm feeling luckyGitHub sign in

partition-by



    function
    boot.janet on line 1533, column 1

    (partition-by f ind)

    Partition elements of a sequential data structure by a 
    representative function `f`. Partitions split when `(f x)` changes 
    values when iterating to the next element `x` of `ind`. Returns a 
    new array of arrays.


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