each-integer-from ( ... from to quot: ( ... i -- ... ) -- ... ) (original) (raw)

each-integer-from ( ... from to quot: ( ... i -- ... ) -- ... )

Vocabulary
math

Inputs

from an integer
to an integer
quot a quotation

Outputs
None

Word description
Applies the quotation to each integer in [from..to) in order.

Definition

USING: kernel ;

IN: math

: each-integer-from
( ... from to quot: ( ... i -- ... ) -- ... )
2over <
[ [ nip call ] 3keep [ 1 + ] 2dip each-integer-from ]
[ 3drop ] if ; inline recursive