Handbook
Glossary
map-sum ( ... seq quot: ( ... elt -- ... n ) -- ... n )
Vocabulary
sequences
Inputs
seq
a
sequence
quot
a
quotation
Outputs
n
a
number
Word description
Like
map sum
, but without creating an intermediate sequence.
Examples
USING: math ranges sequences prettyprint ; 100 [1..b] [ sq ] map-sum .
338350
Definition
USING:
kernel
math
;
IN:
sequences
:
map-sum
( ... seq quot: ( ... elt -- ... n ) -- ... n )
[
0
]
2dip
[
dip
+
]
curry
[
swap
]
prepose
each
;
inline