new-like ( len exemplar quot -- seq ) - Factor Documentation

new-like ( len exemplar quot -- seq )


Vocabulary
sequences

Inputs
len an integer
exemplar an exemplar sequence
quot a quotation


Outputs
seq a sequence


Word description
Creates a new sequence of length len and calls the quotation with this sequence on the stack. The output of the quotation and the original exemplar are then passed to like so that the output sequence is the exemplar's type.

Definition
USING: kernel ;

IN: sequences

: new-like ( len exemplar quot -- seq )
over [ [ new-sequence ] dip call ] dip like ; inline

AltStyle によって変換されたページ (->オリジナル) /