define
|
The define special form permits the user to declare a new variable and
initialize it to an Lambda. The Lambda may receive zero or more arguments, and its body
may have zero or more expressions. In this form, define always returns the value to
which name is initialized (Note: this value will always be an Lambda object). If a list of argument names is specified (name arg...), at runtime,
the Lambda's arguments are bound to the actual arguments respectively. Passing an
incorrect number of arguments results in an error message. (See the lambda
special form). If an indefinite list of argument names is specified (name arg...) , at runtime,
the Lambda's arguments are bound to the actual definite arguments respectively.
Passing too few arguments results in an error message. If too many arguments are passed,
the remaining arguments can only be accessed via the argCount and argFetch
functions. (See the lambda special form). The keyword faces: (var...) declares the interfaces feature Structure of the
Lambda. The features are specified as lists, faces: ((english true) (french false)),
the listed feature is initialized to the value specified. The keyword vars: (var...) declares the temporary variables of the Lambda.
The variables are specified as a list vars: (X Y...). If any one of the variables
is specified as a list, vars: ((X 0) Y...), the listed variable is initialized
to the constant value specified. (The local variable X is initialized to the constant 0).
Unlike the setq or define special forms, the vars special form always evaluates
the initialization value as a constant. The keyword pvars: (var...) declares the persistent variables of the Lambda.
The variables are specified as a list pvars: (W Q...). If any one of the
variables is specified as a list, pvars: ((X 0) Y...), the listed variable
is initialized to the constant value specified. (The variable X is initialized to the
constant 0). Unlike the setq or define special forms, the pvars
special form always evaluates the initialization value as a constant. <![endif]>. The keyword cvars: (var...) declares the persistent class variables of the Lambda.
The variables are specified as a list cvars:(W Q...). If any one of the variables is
specified as a list, cvars: ((X 0) Y...), the listed variable is initialized to the
constant value specified. (The variable X is initialized to the constant 0). Unlike the
setq or define special forms, the cvars special form always evaluates the
initialization value as a constant. The keyword rvars: (var...) declares the register variables of the Lambda.
The variables are specified as a list rvars:(W Q...). If any one of the variables is
specified as a list, regs: ((X Integer) Y...), the listed variable is initialized to the
type value specified (Integer, Number, CharPointer, ShortPointer, JumpPointer, IntPointer, or NumPointer).
The variable X is initialized to the data type Integer (up to fifty register variables are allowed).
Unlike the cvars or pvars special forms, the regs special form always evaluates the
initialization value as a data type. The keyword doomed: declares that the Lambda is to be evaluated, by the garbage collector, when the
Lambda is doomed. The Lambda's EvalWhenDoomed property is set to true. The Lambda is always evaluated,
by the garbage collector, with no arguments. The body of the Lambda is a sequence of Lisp expressions {exp}. At runtime, each of the expressions is
evaluated, in the extended environment, from left to right. The Lambda returns the value of the final expression
in the sequence. Usage The define function defines the name of an Lambda, its arguments, and the statements that
comprise the Lambda.
(define (name arg...) faces: (var...) vars: (var...) pvars: (var...)
cvars: (var...) regs: (vars...) exp...) An Lambda that will be assigned the name {child}.
Expression:
Arguments
Name
Type
Description Argument: (arg...) ---
Optional Argument. Argument list for the Lambda. Argument: faces:(var...) Symbol
Optional Argument. If present, must be followed by a interfaces feature list. Argument: vars:(var...) Symbol
Optional Argument. If present, must be followed by a local variable list. Argument: pvars:(var...) Symbol
Optional Argument. If present, must be followed by a persistent variable list. Argument: cvars:(var...) Symbol
Optional Argument. If present, must be followed by a persistent class variable list. Argument: regs:(var...) Symbol
Optional Argument. If present, must be followed by a register variable list
(up to fifty register variables are allowed). Argument: exp... ---
The Lisp statements that forms the Lambdas
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Lambda | Symbol |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|