define

Help Contents Procedure Definition define
copyDef defineBe

define procname text


command. Defines a procedure with name "procname" and text "text". If there is already a procedure with the same name, the new definition replaces the old one. The text input must be a list whose members are lists. The first member is a list of inputs; it looks like a to line but without the word TO, without the procedure name, and without the colons before input names. In other words, the members of this first sublist are words for the names of required inputs and lists for the names of optional or rest inputs. The remaining sublists of the text input make up the body of the procedure, with one sublist for each instruction line of the body. (There is no END line in the text input.) It is an error to redefine a primitive procedure unless the variable REDEFP has the value TRUE.

Examples:

define "go [[] [fd 100]]
go
cs
define "go [[steps] [fd 300*steps]]		;so go is a "scaled fd"
go .5
go .25
go .125
cs
define "go [[[steps 1]] [fd 300*steps]]
go		;moves the turtle to the upper border, drawing
cs
(go 0.5)		;moves the turtle till half the upper border

See also:

References:

copyDef defineBe