Newsgroups: comp.lang.lisp
From: Vassil Nikolov <vniko...@poboxes.com>
Date: 1999/04/05
Subject: singleton references (Ex: Re: Constants and DEFCONSTANT)
In article <sfwzp4pj9op....@world.std.com>,
Kent M Pitman <pit...@world.std.com> wrote: > Vassil Nikolov <vniko...@poboxes.com> writes: Oh, yes. Of course it is highly implementation dependent, but my > > how about a zero-dimensional array as an idiom for a half-cons > As a rule, arrays are higher overhead to access than conses. And they `generalised implementation-independent' estimate is 8 bytes (which is useful only to maintain some _rough_ mental idea of storage costs). I hope I mentioned it that I was aware of higher costs---the reason (In fact, assuming 64 bits of header and, in a 64-bit architecture, > It might help a little if you knew the 0d array was also simple.(I It ought to be possible to have a 0d displaced array. But adjustable? > never saw a displaced or adjustable 0d array, but I think it's > possible in principle. :-) Don't ask, don't tell... > Maclisp had the HUNK datatype which was the right thing. It was a I had known about Maclisp's hunks only from comp.lang.lisp. They do > generalized cons that had however many parts you wanted. A 1-element > hunk was still of type HUNK2 (represented identically to CONS, but in > a different allocation space) but had a filler in one of its slots that > said "nothing here". I was sad hunks went away, though they really > were a kind of hack ... I guess the main reason they went away was that look like what I want but I know I should not be holding my breath for their re-introduction into the language. > they had been co-opted as a low-level implementation substrate for In theory at least, an implementation could have a specific tag for > implementing class-like things in pre-class-system days, and when a > real class data structure came along, it wasn't as needed. I suppose > you could use a structure with only one slot, but since it would have > a header saying the type of the structure, it would take up the same > space as a CONS anyway. Just can't quite win. a singleton reference so that the reference itself does take half the space for a cons cell. But even though it could, I don't expect that it would, it being too much trouble for something that's rarely needed. But, before worrying about storage, I worry about a clear expression (1) Using a cons is most efficient but is one of those `cancer of the (let ((ref (cons foo nil))) ;the cdr will not be used (2) Using a structure makes for a program where adding a second slot (3) Of course I could say (defstruct ref obj) ;thou shalt have just this slot but on the other hand sometimes I (perhaps others too) prefer Anyway, this exercise is not worth more than the proverbial two cents I also remember the case of Algol-68, which among other things tried Vassil Nikolov <vniko...@poboxes.com> www.poboxes.com/vnikolov -----------== Posted via Deja News, The Discussion Network ==---------- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||