Subject: Re: Constants and DEFCONSTANT
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/04/04
Newsgroups: comp.lang.lisp
Message-ID: <7e6rsp$kb86@fido.engr.sgi.com>
Vassil Nikolov  <vnikolov@poboxes.com> wrote:
+---------------
| how about a zero-dimensional array as an idiom for a half-cons
| (i.e. a singleton reference)?
+---------------

Several Scheme implementations have such a notion for a half-cons,
conventially called a "box":

	> (define foo (box 37))		; some call it "make-box"
	> (box? foo)
	#t
	> (unbox foo)
	37
	> (set-box! foo 24)
	> (unbox foo)
	24
	>

In Common Lisp, of course, I guess you could always do:

	> (defstruct box (content))
	BOX
	> (setq foo (make-box :content 37))
	#S(BOX :CONTENT 37)
	> (box-content foo)
	37
	>

but I'm not sure how much overhead CL drags along with a structure instance
(in addition to the slots themselves)...


-Rob

p.s. FWIW, MzScheme provides the following
printer & reader syntax for boxes:

	> foo
	#&24
	> (box? #&51)
	#t
	> (unbox #&51)
	51

-----
Rob Warnock, 8L-855		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-964-0811
Mountain View, CA  94043	PP-ASEL-IA