map-sum ( ... seq quot: ( ... elt -- ... n ) -- ... n )


Vocabulary
sequences

Inputs and outputs
seqa sequence
quota quotation
na number


Word description
Like map sum, but without creating an intermediate sequence.

Examples
USING: math math.ranges sequences prettyprint ; 100 [1,b] [ sq ] map-sum .
338350


Definition


: map-sum ( ... seq quot: ( ... elt -- ... n ) -- ... n )
[ 0 ] 2dip [ dip + ] curry [ swap ] prepose each ; inline