From: Jedrzej Nasiadek
Subject: symbols and strings
Date: 
Message-ID: <87g04z5e1z.fsf@yenisko.home.astercity.net>
Hi!

I'm still learning lisp, and I'm writing a simple
parser now. I'm curious when it pays to use symbols instead
of strings? And, on the other hand - when it's completely unwise
to use them and it's better to use strings?

best regards,
   Jedrzej Nasiadek

From: Janis Dzerins
Subject: Re: symbols and strings
Date: 
Message-ID: <a2jkbl$or0$1@milzis.latnet.lv>
Jedrzej Nasiadek <·············@away-ia.pw.edu.pl> writes:

> I'm still learning lisp, and I'm writing a simple
> parser now. I'm curious when it pays to use symbols instead
> of strings? And, on the other hand - when it's completely unwise
> to use them and it's better to use strings?

If you use function read for reading, you will have symbols.  But I
would use function read for reading Lips forms (or something else in
some exceptional cases).  I would say that it pays to use symbols if
the symbols you expect to read are already present in the package you
read them into or if the new symbols are expected to be used in the
program (and maybe for reading lists of numbers, but this is not
relevant to the question).

For parsing arbitrary text, I would not use function read, since it
might create a lot of unnecessary symbols, which are quite complex
objects with many attributes that are not really needed for parsing
(see CLHS entry on symbol).  If there is a need for interned objects
(like stirngs), it's easy to accomplish with hashtables.

-- 
Janis Dzerins

  Eat shit -- billions of flies can't be wrong.
From: Brian P Templeton
Subject: Re: symbols and strings
Date: 
Message-ID: <87it9rxohu.fsf@tunes.org>
Jedrzej Nasiadek <·············@away-ia.pw.edu.pl> writes:

> Hi!
> 
> I'm still learning lisp, and I'm writing a simple
> parser now. I'm curious when it pays to use symbols instead
> of strings? And, on the other hand - when it's completely unwise
> to use them and it's better to use strings?
> 
Are you writing a parser that translates into Common Lisp objects
only, or also a complete interpreter? Are you asking w.r.t. parsers,
or generally?

> best regards,
>    Jedrzej Nasiadek

-- 
BPT <···@tunes.org>	    		/"\ ASCII Ribbon Campaign
backronym for Linux:			\ / No HTML or RTF in mail
	Linux Is Not Unix			 X  No MS-Word in mail
Meme plague ;)   --------->		/ \ Respect Open Standards