[plt-scheme] gensym & comparison

From: Filipe Cabecinhas (filcab at gmail.com)
Date: Fri Jun 20 18:58:10 EDT 2008

On 20 Jun, 2008, at 23:53, YC wrote:

> Hi -
>
> Is there a way to compare gensym symbols with a manually created  
> symbol, short of converting them to strings?  It's okay if not -  
> just want to know the reason that they cannot be compared?
>
> > (define sym (gensym))
> > sym
> g30043
> > (equal? sym 'g30043)
> #f
> > (equal? 'g30043 'g30043)
> #t
>

The purpose of gensym is to create an uninterned symbol, that no one  
can produce again. Normally a symbol that is read is interned and  
everytime a symbol with the same name is read, the same symbol is  
returned. So that is the desired behaviour.

I don't know if there's a way to intern a "gensymmed" symbol, but you  
could hammer it by creating you own gensym that would use string- 
 >symbol and a counter you had.

   - Filipe Cabecinhas



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080620/a8a9e1ff/attachment.html>

Posted on the users mailing list.