Handbook
Glossary
mnmap ( m*seq quot m n -- result*n )
Generalized sequence words
Prev:
nmap-as ( seq... quot exemplar n -- result )
Next:
mnmap-as ( m*seq quot n*exemplar m n -- result*n )
Vocabulary
sequences
.
generalizations
Inputs
m*seq
m
sequences on the datastack
quot
a
quotation
with stack effect
( m*element -- result*n )
m
an
integer
n
an
integer
Outputs
result*n
n
sequences of the same type as the first
seq
Word description
A generalization of
map
,
2map
, and
3map
that can map over any number of sequences in parallel and provide any number of output sequences.
Definition
USING:
generalizations
kernel
;
IN:
sequences.generalizations
:
mnmap
( m*seq quot m n -- result*n )
2dup
[
[
npick
]
curry
]
dip
[
[
dip
swap
]
curry
]
dip
[
dupn
]
curry
compose
2dip
mnmap-as
;
inline