(defun-q [c:] name ([arg1 arg2 ...] / [local-var1 local-var2 ...]) expression)
Creates a LISP function as a list.
The defun-q function is similar to the defun function but preserves the function definition as a list of expressions that can be accessed with the (defun-q-list-ref 'name) function. This allows you to review and adjust the body of the already-created function. The defun-q function should not be used and is provided for support of legacy Autodesk® AutoCAD® LISP scripts.
The function returns the name of the defined function.
Example
The following example creates a MyFn function and calls it, gets it as a list, modifies and updates it, and calls it again to view the output:
;; Create a function using (defun-q)
(defun-q MyFn (x y) (princ (* x y)))
;; Call (MyFn) so you can see the output – output should be 12.0
(MyFn 3.0 4.0)
;; Now get the function returned as a list so it can be modified
(setq FnList (defun-q-list-ref (quote MyFn)))
;; Now modify the function to multiply x*x*y, not just x*y
(setq NewFnList (list (car FnList) (quote (princ (* x x y)))))
;; Update MyFn to use the new function
(defun-q-list-set (quote MyFn) NewFnList)
;; Now call (MyFn) again and view the output – output should be 36.0
(MyFn 3.0 4.0)
Tell me about...
(defun [c:] name ([arg1 arg2 ...] / [local-var1 local-var2 ...]) expression)
Programming Overview of LISP (LISt Processing) Language
en
italiano
čeština
Deutsch
français
hrvatski
magyar
polski
српски
русский
中文
中文
한국어
español