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

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

Re: conditionals in elisp


From: Pascal J. Bourguignon
Subject: Re: conditionals in elisp
Date: Wed, 28 Oct 2009 18:45:54 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)

David Kastrup <dak@gnu.org> writes:

> pjb@informatimago.com (Pascal J. Bourguignon) writes:
>
>> Ok. It's quite simple really.  
>> Here the 5-minute all you need to know about lisp:
>>
>>
>> There are two kinds of data:
>>
>> - atoms, and
>> - lists.
>
> Actually, conses.

Right.  Oops!  More than five minutes!


>> Atoms are numbers of various sort such as: 123 1.23 1.2e.3,  vectors
>> such as [1 2 3], strings such as "abc", and other kind of objects such
>> as functions, predefined data structures (eg. hash-tables), or user
>> defined structures or objects, and  symbols such as: foo print if
>> what-a-nice-day, +, -, etc, that are used to name the various things
>> such as variables or functions.  (Symbol can contain mostly any
>> character that wouldn't be interpreted as another kind of atom or
>> list, including spaces (just escape them with \)).
>
> You forgot the atom nil which is also a list, though not a cons.
>
>> Lists are sequences of data enclosed in parentheses:
>>
>> (a list containing only symbols)
>> (a list containing (a sub list))
>> (1 list containing 2 numbers and a "string")
>
> Lists are nil or a cons...  Data enclosed in parentheses is a shortcut
> for a certain kind of conses.

Way more than five minutes!


> (cons 1 (cons 2 (cons 3 nil)))
>
> is short for (list 1 2 3).
>
>> All the rest is rather accidental, it could be different, and it would
>> still be lisp.  It may change from one kind of lisp to another too
>> (emacs lisp, Common Lisp, ISO-Lisp, Scheme, and older variants).
>
> Scheme is quite different: in Lisp, a symbol has a name, a property
> list, a value cell, a function cell.  In Scheme, there are just name and
> value cell,  and I am not sure that the name leads as much a life of its
> own as in Lisp.

No, in scheme (r5rs), symbols don't even have a value (this would be
useless, since there is only lexical bindings in scheme).  But now we
need one hour to explain...



-- 
__Pascal Bourguignon__


reply via email to

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