defchild
|
The defchild Macro creates a new Lambda object and assigns it to the specified
persistent variable name {child} of the parent Lambda {parent}. The
defchild Macro always returns the newly created Lambda object. Following the
defchild Macro, the new Lambda will be invoked whenever the child member of the
parent Lambda is referenced. For instance below we define a math Lambda, use the defchild macro to add a child Lambda, and then
invoke the math Lambda and a few of its child Lambdas. Usage Use the defchild when the parent Lambda and all its children are too large for one
source file, or when you wish each child Lambda to be defined in a separate source
file from the parent.
(defun math(Number:z)
pvars:((myX 100.0))
(defun add(Number:z)
(+ myX z)) ;; end of add function
;;.... other child functions here
(- myX z)) ;; end of math function
(defchild math:mul(Number:z)
(* myX z)) ;; end of mul function
;; Invoking the various child functions of the math Lambda
(math 22.0) ;; returns 88.0
(math.add 10.0) ;; returns 110.0
(math.mul 10.0) ;; returns 1000.0
(defchild parent:child(arg...) faces:(var...) pvars:(var...)
cvars:(var...) regs:(var...) vars:(var...) exp...) (defchild parent child(arg...) faces:(var...) pvars:(var...)
cvars:(var...) regs:(var...) vars:(var...) exp...) (defchild parent.mem child(arg...) faces:(var...) pvars:(var...)
cvars:(var...) regs:(var...) vars:(var...) exp...) An Lambda that will be assigned the name {child}.
Expression:
Arguments
Name
Type
Description Argument: parent: Symbol
The Parent Lambda that the child will be associated with. Argument: child: Symbol
The name of the new Lambda object (the Child Lambda). 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
|