Added DEF macro to define dynamic variables in user space and get

around the 'undefined variable' warnings when using SETF without
prior variable declaration.
This commit is contained in:
Gerd Heber 2015-08-08 09:12:49 -05:00
parent 71596227c8
commit c1fbc5ab70
2 changed files with 20 additions and 0 deletions

View File

@ -405,6 +405,7 @@
CPRD
CRPR
D
DEF
F
DFFR
DGNL

View File

@ -6,6 +6,25 @@
(PROVIDE "macros")
;;;
;;; UTILITIES
(defmacro def (name value)
(declare (type symbol name))
"-----------------------------------------------------------------[macro-doc]
DEF
Args: (name value)
Defines a dynamic variable NAME in the CL-USER package, assigns it VALUE,
and returns VALUE.
------------------------------------------------------------------------------"
`(progn
(intern (symbol-name ',name))
(defparameter ,name nil)
(setq ,name ,value)))
;;;
;;; VARIOUS
;;;