[Haskell-cafe] Efficient object identity (aka symbols as data)

Jacek Generowicz Jacek.Generowicz at cern.ch
Thu May 26 12:31:18 CEST 2011

On 2011 May 26, at 11:59, Brandon Allbery wrote:

>> On Thu, May 26, 2011 at 05:41, Jacek Generowicz <Jacek.Generowicz at cern.ch 
>> > wrote:
>>> On 2011 May 26, at 11:12, Brandon Allbery wrote:
>>> (Think gensym.  Hm, except last time I did anything serious with  
>>> Lisp, it was Maclisp... does gensym even still exist, or did CL do  
>>> something inscrutable with it?)
>> But gensym does seem to be overkill in the case I presented.
>> (...) In Lisp terms, I'm looking for make-symbol and intern.
> I think I just landed on "inscrutable";

Nah, it's probably just me confusing you.

> (gensym) used to do pretty much that, it rolled symbols starting  
> from 'a0000 for the first one generated in a given interpreter.

It still does essentially that. (Just don't be fooled by the "name"  
a0000: you can't access that symbol through that name. Aaaah, maybe in  
Maclisp it really did intern them under that name, but that would  
surprise me).

'(gensym)' in CL is a bit like 'object()' in Python or 'new  
MyEmptyClass' in C++: the key point being that if you don't bind the  
thing being created right now, you'll never be able to get your hands  
on it again.

Coming back on topic: Yes, I could use gensym for my purposes (though  
CL provides a variety of similar yet subtly different tools, which is  
why gensym feels a bit weird in this context).

More information about the Haskell-Cafe mailing list