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

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

Re: conditionals in elisp


From: David Kastrup
Subject: Re: conditionals in elisp
Date: Wed, 28 Oct 2009 15:05:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

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.

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

(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.

-- 
David Kastrup


reply via email to

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