[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why not "stripes" in: (let ((zebra 'stripes) ... ; strings vs symbol
From: |
Rustom Mody |
Subject: |
Re: why not "stripes" in: (let ((zebra 'stripes) ... ; strings vs symbols? |
Date: |
Mon, 30 Dec 2013 22:16:49 +0530 |
On Sunday, December 29, 2013 7:53:32 PM UTC+5:30, Gregor Zattler wrote:
> Dear emacsophiles,
> ATM i read "An Introduction to Programming in Emacs Lisp". In
> the section where the let function is explained in detail the
> author, Robert J. Chassell, uses this "silly" example:
> (let ((zebra 'stripes)
> (tiger 'fierce))
> (message "One kind of animal has %s and another is %s."
> zebra tiger))
> which when evaluated produces "One kind of animal has stripes and
> another is fierce." as output.
> The thing which makes me wonder is why he uses 'stripes instead
> of "stripes" in this example. In the output of the message
> function it makes no difference but to me it seems more natural
> to use strings here since they are part of a string in the output...
> I do not really understand how the 'stripes are different
> to "stripes". Isn't 'stripes a notation for the symbol
> stripes? This would mean there is the notion of a symbol which
> is bound to noting?
> Could somebody please enlighten me as to what the differences
> between "stripes" and 'stripes are
> and
> in which cases which notation is more useful/natural?
In http://www.catb.org/esr/faqs/hacker-howto.html Eric Raymond says:
LISP is worth learning for a different reason — the profound
enlightenment experience you will have when you finally get it. That
experience will make you a better programmer for the rest of your
days, even if you never actually use LISP itself a lot.
So...
You are almost there... at the Zen of Lisp!
And getting lisp symbols is an important part of that
Lisp is a completely bizarre language because unlike most others its
primary data structure -- S-exp -- is identical to that used for (lisp) code.
Very key to that is that symbols do double duty
- they are variables like in other languages
- they are data like strings in other languages
For more on this look up homoiconicity
Also Ive a blog post on that
http://blog.languager.org/2013/08/applying-si-on-sicp.html
But for that you need to know scheme
- Re: why not "stripes" in: (let ((zebra 'stripes) ... ; strings vs symbols?,
Rustom Mody <=