Defines an anonymous function
(lambda arguments expr...)
lambda function when the overhead of defining a new function is not justified. It also makes your intention more apparent by laying out the function at the spot where it is to be used. This function returns the value of its last expr, and is often used in conjunction with apply and/or mapcar to perform a function on a list.
Use theArguments
Arguments passed to an expression.
An AutoLISP expression.
Return Values
Value of the last expr.
Examples
lambda function from the Visual LISP Console window:
The following examples demonstrate the_$ (apply '(lambda (x y z)
(* x (- y z))
)
'(5 20 14)
)
30
_$ (setq counter 0)
(mapcar '(lambda (x)
(setq counter (1+ counter))
(* x 5)
)
'(2 4 -6 10.2)
)
0
(10 20 -30 51.0)