That's why I defined version of "set" named set-undefined - if symbol already has value, set-undefined throws an error.
SU is especially useful.(set 'set-undefined
(lambda-macro(var-expr val-expr)
(let ((evar-expr (eval var-expr)))
(when (eval evar-expr)
(throw-error (append (char 8)
(char 8)
(char 8)
": "
"(SU " (string var-expr)
" " (string val-expr)
") where "
(string var-expr)
" => "
(string evar-expr)
" => "
(string (eval evar-expr)))))
(set 'toeval (list 'set
(list 'quote evar-expr)
val-expr))
(eval toeval)
nil)))
(set-undefined 'SU set-undefined)
Ops. I didn't syntax-colored this post. OK, we can live with that.
No comments:
Post a Comment