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