Making sequences with variables - Factor Documentation (original) (raw)

The make vocabulary implements a facility for constructing sequences and assocs by holding a collector object in a variable. Storing the collector object in a variable rather than the stack may allow code to be written with less stack manipulation.

Object construction is wrapped in a combinator:

Inside the quotation passed to make, several words accumulate values:

% ( seq -- )
# ( n -- )

When making an assoc, you can use these words to add key/value pairs:

%% ( assoc -- )

The collector object can be accessed directly from inside a make:

USING: make math.parser ; [ "Language #" % CHAR: \s , 5 # ] "" make print
Language # 5

Make philosophy