( lambda )允許你寫即時的( mapcar )表達式中的( DTR )功能,
而不必定義一個單獨的函數。
(setq d (mapcar (quote (lambda (a) (* pi (/ a 180.0)))) c))
或
(setq d (mapcar '(lambda (a) (* pi (/ a 180.0))) c))
此功能將在列表C中的所有角度轉換為弧度並將其存儲在變數d。
;---------------------------------------------------------------
(lambda (a) (* pi (/ a 180.0)))
(defun (a) (* pi (/ a 180.0)))
以上兩種寫法功能相同.
;---------------------------------------------------------------
(defun c:test () (setq c '(23.0 47.8 52.1 35.6)) (setq d (mapcar '(lambda (a) (* pi (/ a 180.0))) c)) (mapcar 'set '(w x y z) d) (princ) ) !c should return (23.0 47.8 52.1 35.6) !d should return (0.401426 0.834267 0.909317 0.621337) !w should return 0.401426 !x should return 0.834267 !y should return 0.909317 !z should return 0.621337