From: Devon S. M. <Lisp-Hacker@Jovi.Net> - 2006-02-12 20:39:45
|
From: Pascal Bourguignon <pj...@in...> To: spazzsloth <kao...@gm...> Date: Sun, 12 Feb 2006 19:01:24 +0100 ... (defun make-var (&key var-name value) (proclaim `(special ,var-name)) (setf (symbol-value var-name) (make-hash-table :test #'equal)) (setf (documentation var-name 'variable) "A variable made by MAKE-VAR") (set-prop var-name 'value value)) ... perhaps better as (defmacro make-var (&key var-name value) `(progn (defparameter ,var-name (make-hash-table :test #'equal)) (set-prop ,var-name 'value ,value))) (defun set-prop (var-name prop-name prop-value) (setf (gethash prop-name var-name) prop-value)) or better yet (defstruct var ...) and (setf (var ...) ...) etc. but isn't this more a deployment and debugging list than a tutorial list? Most users who think they want globals are novices who have yet to learn better ways. Peace --Devon /~\ \ / Health Care X not warfare / \ Dubya won the digital vote Kerry won the popular vote |