Handbook
Glossary
2map-as ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Sequence combinators
»
Pair-wise sequence combinators
Prev:
2map ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) -- ... newseq )
Next:
2map-reduce ( ..a seq1 seq2 map-quot: ( ..a elt1 elt2 -- ..a intermediate ) reduce-quot: ( ..a prev intermediate -- ..a next ) -- ..a result )
Vocabulary
sequences
Inputs
seq1
a
sequence
seq2
a
sequence
quot
a
quotation
with stack effect
( ... elt1 elt2 -- ... newelt )
exemplar
a
sequence
Outputs
newseq
a new sequence
Word description
Applies the quotation to each pair of elements in turn, yielding new elements which are collected into a new sequence having the same class as
exemplar
.
Definition
USING:
kernel
sequences.private
;
IN:
sequences
:
2map-as
( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... newelt ) exemplar -- ... newseq )
[
2length-operator
]
dip
map-integers-as
;
inline