each-line ( ... from to quot: ( ... line -- ... ) -- ... )
Factor documentation > Factor handbook > UI framework > Building user interfaces > Pre-made UI gadgets > Editor gadgets > Documents
Prev:remove-doc-range ( from to document -- )
Next:Document locations


Vocabulary
documents

Inputs and outputs
froma non-negative integer
toa non-negative integer
quota quotation with stack effect ( ... line -- ... )


Word description
Applies the quotation to each line in the range.

Notes
The range is created by calling <slice>.

Errors
Throws an error if from or to is out of bounds.

Definition
USING: kernel math.ranges sequences ;

IN: documents

: each-line
( ... from to quot: ( ... line -- ... ) -- ... )
2over = [ 3drop ] [ [ [ first ] bi@ [a,b] ] dip each ] if ;
inline