[racket] Interned and uninterned symbols

From: Jos Koot (jos.koot at telefonica.net)
Date: Wed Aug 17 06:56:02 EDT 2011

May be the following example may help:
 
In definitions window of DrRacket:
 
#lang racket
(define a 'interned-symbol)
(define b 'interned-symbol)
(define c (string->uninterned-symbol "uninterned"))
(define d (string->uninterned-symbol "uninterned"))
(list a b c d)
(eq? a b)
(eq? c d)
 
Now run it and and inspect the interactions window:
 
(interned-symbol interned-symbol uninterned uninterned)
#t
#f <---- although the two uninterned symbols have the same name.
 
So you see that an uninterned symbol is really unique and will not be
confused with any other symbol of the same name.
I used string->uninterned-symbol in stead of gensym, because
string->uninterned-symbol allows you to exactly provide the name of the
symbol.
 
Jos

  _____  

From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Harry Spier
Sent: miércoles, 17 de agosto de 2011 1:18
To: users at racket-lang.org
Subject: [racket] Interned and uninterned symbols


Dear list members,


Could someone expand a little on the reference guides explanation of the
difference between interned and uninterned symbols.  In particular what
exactly is an uninterned symbol?

Thanks in advance,
Harry Spier
-

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

Posted on the users mailing list.