DEFINE

Syntax

DEFINE name instructionlist

Explanation

DEFINE names a new procedure with the name of its first input. The second input to DEFINE determines the definition of the procedure.

Variable(s) in the title line must be the first element(s) of the list of instructions, with no dots before their name(s). If there are no variables, the first element must be the empty list.

Each remaining element in the list of instructions is a list which consists of one line of the procedure definition. The list of instructions is written in the same form as the output of TEXT.

END must not be included in the list of instructions, as it is not part of the definition.

Examples

? DEFINE "SQUARE ] [REPEAT 4 [FD 100 RT 90]

? PO SQUARE

TO SQUARE


 * REPEAT 4 [FD 40 RT 90]

END

? DEFINE "HEX LENGTH] [REPEAT 6 [FD :LENGTH RT 60]

? PO HEX

TO HEX :LENGTH


 * REPEAT 6 [FD :LENGTH RT 60]

END

?