lambda

 

 

Overview

The lambda special form returns an instance of a Lambda object. When called, the Lambda extends its environment to include the specified argument variables {arg}, the arguments are received and bound to the proper variables {arg}, the expressions {exp} are evaluated from left to right, and the value of the final expression is returned.

An Analytic Information Server Lambda may be defined, with a definite list (fixed) or an indefinite list of arguments (variable). The ellipses at the end of the argument list indicate the function has indefinite arguments. At run time, the Lambda's actual arguments are bound to the specified formal definite arguments respectively. An error is generated if there are too few arguments in the definite argument list. If the number of actual arguments exceed the number of definite arguments, and the function has been defined as having indefinite arguments, the excess arguments can only be accessed during via the argCount and argFetch functions at run time.

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 follows 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 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.

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, 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 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 body of the Lambda is a sequence of Lisp expressions {exp}. At run time, 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

Use the lambda special form when an Lambda is to be created in Lisp. The Lambda is not assigned to a global variable as with the defun macro.

 

Syntax


Expression: (lambda(arg...) faces:(var...) vars:(var...) pvars:(var...) cvars:(var...) regs:(var...) exp...)

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:

An Lambda object.



 

Examples

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.

 

Argument Types

Here are the links to the data types of the function arguments.

Lambda

Here are also a number of links to functions having arguments with any of these data types.

argCount argFetch attachLibrarian balance
callcc class compareEQ compareGE
compareGT compareLE compareLT compareNE
compare compile copy debugBrowsableProcs
debug defchild defclass define(macro)
define defmacro defmethod deforphan
defriend defun detachLibrarian disassemble
evalInSyncLocalContext eval exportCsv exportSbf
exportTab globalBinding importCsv importSbf
importTab inspect isClass lambda
lisp macroReplace makeLambda myself
new onError refLibrarian ref
send setq super

Analytic Information Server (AIS)

AIS Component Systems

  • Smartbase Engine
  • QT C++ Libraries
  • MySQL Relational Database
  • AIS Lisp Libraries
  • Rapid Analytic Demo IDE