Handbook
Glossary
map-if ( ... seq if-quot: ( ... elt -- ... ? ) map-quot: ( ... elt -- ... newelt ) -- ... newseq )
Vocabulary
sequences
.
extras
Inputs
seq
a
sequence
if-quot
an
object
map-quot
an
object
Outputs
newseq
a
sequence
Word description
A version of
map
where
map-quot
is applied only if
if-quot
returns true for a given element.
Definition
USING:
kernel
sequences
;
IN:
sequences.extras
:
map-if
( ... seq if-quot: ( ... elt -- ... ? ) map-quot: ( ... elt -- ... newelt ) -- ... newseq )
[
[
[
dup
]
]
dip
compose
]
dip
[
when
]
curry
compose
map
;
inline