Article View: comp.lang.lisp.x
Article #331Re: *unbound* in *obarray*
From: hume smith
Date: Sun, 10 Jan 1993 21:34
Date: Sun, 10 Jan 1993 21:34
38 lines
2005 bytes
2005 bytes
In article <21495.1993Jan5.174456@bcars148> emcoop@bnr.ca (hume smith) writes:
> (let* ((ind (hash "*UNBOUND*" (length *obarray*)))
> (ls (aref *obarray* ind))
> (z (car (member "*UNBOUND*" ls :test #'string= :key #'symbol-name))))
> (unless (boundp 'z)
> (setf (aref *obarray* ind) (remove "*UNBOUND*" ls :test #'string= :key #'symbol-name))))
of course boundp doesn't work right (i.e. the way i wish it did :-)
with "letted" variables... this all has to be done in the global environment.
(setq ind (hash "*UNBOUND*" (length *obarray*))
ls (aref *obarray* ind)
z (car (member "*UNBOUND*" ls :test #'string= :key #'symbol-name)))
(unless (boundp 'z)
(setf (aref *obarray* ind) (remove "*UNBOUND*" ls :test #'string= :key #'symbol-name))))
i just LOVE saying stupid things in front of the whole world :-)
to make up for it: here's a definition with-open-stream. not much use
in `standard' XLisp, but nice with my client and accept accept functions.
and it can be used on an already-open stream, of course... the uninterned
symbol protects against things like
(with-open-stream (x z) (setq x 'b))
(defmacro with-open-stream (sym-stream &rest body)
(let ((sym (first sym-stream))
(stream (second sym-stream))
(gsym (gensym)))
`(let* ((,gsym ,stream)
(,sym ,gsym))
(unwind-protect
(progn ,@body)
(close ,gsym)))))
--
Hume Smith
hume.smith@acadiau.ca
emcoop@bnr.ca
Technical Details
Message-ID:
<EMCOOP.93Jan10163434@bcars148.bnr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!cs.utexas.edu!torn!nott!bnrgate!bcars267!bcars267!emcoopReferences:
<21495.1993Jan5.174456@bcars148>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.lisp.x Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!cs.utexas.edu!torn!nott!bnrgate!bcars267!bcars267!emcoop From: emcoop@bnr.ca (hume smith) Subject: Re: *unbound* in *obarray* In-Reply-To: emcoop@bnr.ca's message of Tue, 5 Jan 1993 22:44:56 GMT Message-ID: <EMCOOP.93Jan10163434@bcars148.bnr.ca> Sender: news@bnr.ca (usenet) Nntp-Posting-Host: bcars148 Organization: Bell-Northern Research, Ottawa, Canada References: <21495.1993Jan5.174456@bcars148> Date: Sun, 10 Jan 1993 21:34:34 GMT Lines: 38