Handbook
Glossary
2map-sum ( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... n ) -- ... n )
Vocabulary
sequences
.
extras
Inputs
seq1
a
sequence
seq2
a
sequence
quot
a
quotation
Outputs
n
an
integer
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
seq1
. The resulting sequence is summed.
Definition
USING:
kernel
math
sequences
;
IN:
sequences.extras
:
2map-sum
( ... seq1 seq2 quot: ( ... elt1 elt2 -- ... n ) -- ... n )
[
0
]
3dip
[
dip
+
]
curry
[
rot
]
prepose
2each
;
inline