cut-when ( ... seq quot: ( ... elt -- ... ? ) -- ... before after )


Vocabulary
sequences.extras

Inputs
seqa sequence
quota quotation


Outputs
beforean object
afteran object


Word description
Cut the given sequence before the first element of seq that returns a truthy value when passed into quot. The element will be the first in the after sequence. If no elemnts satisfy the predicate, seq will be empty.

Definition


: cut-when
( ... seq quot: ( ... elt -- ... ? ) -- ... before after )
[ find drop ] keepd swap [ cut ] [ f over like ] if* ;
inline