Defines an anonymous function
Supported Platforms: Windows and Mac OS
(lambda arguments expr ...)
Type: List
Arguments passed to an expression.
Type: List
An AutoLISP expression.
Type: Integer, Real, String, List, T, Symbol, ads_name, or nil
Value of the last expr.
Use the 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.
The following examples demonstrate the lambda function:
(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)