Use a specified name as a parent name in the specified body of forms.
Note:
top-level-form
is deprecated. Use def instead.
This macro is useful in the expansion of defining macros. Every form in the body is given name as its parent name. This can be useful for things such as debugging.
(in-package "CL-USER")
(defmacro define-thing (name value)
`(top-level-form (define-thing ,name)
(install-thing ',name ,value)))
(defun install-thing (x y)
(set x y))
(define-thing the-thing 42)
(define-thing some-thing 43)
; (DEFINE-THING THE-THING)
; (DEFINE-THING SOME-THING)
; (TOP-LEVEL-FORM 3)
In addition, LispWorks is able to find the source of this form if after typing
Meta-.
you enter
(define-thing the-thing)