Handbook
Glossary
3map-reduce ( ..a seq1 seq2 seq3 map-quot: ( ..a elt1 elt2 elt3 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
Vocabulary
sequences
.
extras
Inputs
seq1
a
sequence
seq2
a
sequence
seq3
a
sequence
map-quot
an
object
reduce-quot
an
object
Outputs
result
an
object
Word description
Applies
map-quot
to each triple of elements in turn, yielding new elements which are collected into a new sequence having the same class as
seq1
. The resultant sequence is then reduced with
reduce-quot
.
Definition
USING:
kernel
sequences
;
IN:
sequences.extras
:
3map-reduce
( ..a seq1 seq2 seq3 map-quot: ( ..a elt1 elt2 elt3 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
[
[
[
[
first
]
tri@
]
3keep
]
dip
[
3dip
]
keep
]
dip
compose
1
3each-from
;
inline