Atom - k
- Partition After Truthy Indices
Characters: k
Tags: array , number , boolean , combinatorics
Arity: dyadic
This atom is dyadic, which means it takes two arguments.
Functionality
Partition y
after the truthy indices in x
.
Details
At each truthy index in x
, cut the y
(essentially, each truthy index in x
will be the last element in a sub-list of the result). If the last element of y
is at a truthy index, there will be a trailing empty list. For example, 0,0,1,0,1 k 10R¤
returns [[1, 2, 3], [4, 5], [6, 7, 8, 9, 10]]
and 0,0,1,0,1 k 5R¤
returns [[1, 2, 3], [4, 5], []]
.