auto-core.data.sequence

Helpers on sequence manipulation

idx-of

(idx-of v value)

Returns the index of the first found value in the sequence

idx-of-pred

(idx-of-pred v pred)

Same as idx-of but with a predicate

index-of

(index-of coll pred)

Returns position of the first element matching predicate pred in the sequence.

Pred should be (pred x).

indexed

(indexed s)

Returns a lazy sequence of index, item pairs, where items come from ā€˜s’ and indexes count up from zero.

(indexed ’(a b c d)) => (0 a 1 b 2 c 3 d)

positions

(positions pred coll)

Returns a lazy sequence containing the positions at which pred is true for items in coll.

trim-leading-nil

(trim-leading-nil s)

Remove nil values at the end of a sequence s