How to get a new sequence from an old sequence, the elements of the new one are from the old one until a condition is met
Suppose the condition is #(> % 0)
'(1 2 3 0 3 2 0 1) returns 1, 2, 3
'(0 1 2 3) returns empty seq
'(1 2 3) returns everything.
Note it's not same as filter.
You probably want to use take-while:
(take-while #(> % 0) '(1 2 3 0 3 2 0 1))
=> (1 2 3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With