select-by ( ... seq quot: ( ... elt -- ... x ) compare: ( obj1 obj2 -- ? ) -- ... elt )


Vocabulary
sequences.private

Inputs
seqan object
quota quotation with stack effect ( ... elt -- ... x )
comparea quotation with stack effect ( obj1 obj2 -- ? )


Outputs
eltan object


Definition


: select-by
( ... seq quot: ( ... elt -- ... x ) compare: ( obj1 obj2 -- ? ) -- ... elt )
[
[ keep swap ] curry [ [ first ] dip call ] 2keep
[ curry 2dip pick over ] curry
] [ [ [ 2drop ] [ 2nipd ] if ] compose ] bi* compose
1 each-from drop ; inline