help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why not "stripes" in: (let ((zebra 'stripes) ... ; strings vs symbo


From: Emanuel Berg
Subject: Re: why not "stripes" in: (let ((zebra 'stripes) ... ; strings vs symbols?
Date: Mon, 30 Dec 2013 00:39:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Gregor Zattler <telegraph@gmx.net> writes:

> ATM i read "An Introduction to Programming in Emacs
> Lisp".  In the section where the let function ...

Well, the purpose of that chapter is to introduce
`let', which is sort of like defining a bunch of
variables in other programming languages, but more
powerful as you can bind lots of things, and without
having to worry about type, and the scope (the
parenthesis) is explicit, as always -- apart from some
more subtle differences which you will get to (depends
what you compare to as well).

Also note the `let*' if you want one definition to be
based on a previous one (i.e., get a predator zebra). I
guess `let' is a "function" (but written in C, a
so-called special form) but to me it is just how you
accomplish good code in Lisp. So use it as much as
possible!

> 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?

Yes, I guess - a "string" is a string, and 'stripes is
- 'stripes. When you quote 'something, this is accepted
as it is. In this case, as it "not is" is a variable,
so if it is not quoted, Lisp would look for a value to
replace it with. If you quote a '(left parenthesis),
instead of a function to be evaluated, you get a list.

There is also the backtick, which gets you a list *but*
with a comma, you can evaluate part(s) of the list -
compare:

`(all list (+ 1 2 3))
`(all list but last ,(+ 1 2 3))

(Try to evaluate those.)

All this is due to the nature of Lisp and the mix of
data and code in a shared data structure (the list) and
even using the same syntax.

But there are guys on this list who could explain this
much more accurate than I (and I hope they will).

> 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 this, case, strings would be more natural what I can
see. That's why you should avoid "silly" examples, I
guess, to you future writers. But, check out the
documentation for `message' - and then hit RET on
`format' - and check out "%s":

%s means print a string argument.  Actually, prints any
   object, with `princ'.

So though 'stripes is not a string it works.

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]