Handbook
Glossary
select-by ( ... seq quot: ( ... elt -- ... x ) compare: ( obj1 obj2 -- ? ) -- ... elt )
Vocabulary
sequences
.
private
Inputs
seq
an
object
quot
a
quotation
with stack effect
( ... elt -- ... x )
compare
a
quotation
with stack effect
( obj1 obj2 -- ? )
Outputs
elt
an
object
Definition
USING:
kernel
sequences
;
IN:
sequences.private
:
select-by
( ... seq quot: ( ... elt -- ... x ) compare: ( obj1 obj2 -- ? ) -- ... elt )
[
[
1check
]
curry
[
[
first
]
dip
call
]
2keep
[
curry
2dip
pick
over
]
curry
]
[
[
[
2drop
]
[
2nipd
]
if
]
compose
]
bi*
compose
1
each-from
drop
;
inline