Re: What about these?
- From: "Juan R." <juanrgonzaleza@xxxxxxxxxxxxxxxxxxxx>
- Date: 29 Dec 2006 05:19:27 -0800
John Thingstad ha escrito:
On Fri, 29 Dec 2006 13:11:45 +0100, Juan R.
<juanrgonzaleza@xxxxxxxxxxxxxxxxxxxx> wrote:
(<CAR><.><CDR>) the '.' or binary separator is infix, no prefix.
The same for list notation
(<token><delimiter><token><delimiter><token>) with <delimiter> being
the early ' ,' or the modern ' ' but both in infix position. That is,
(token token token).
'(one . two) means (cons 'one 'two)
(car '(one . two)) 'one
(cdr '(one . two)) 'two
This is a tuple not a list since both cons cells contain a atom.
Syntactically the dot is there to distinguish it from
'(one two) which means (cons 'one (cons 'two nil))
(car '(one two)) 'one
(cdr '(one two)) ('two)
(cadr '(one two)) 'two
It is thus not a infix operator.
Rather it is a reader macro to simplify expressing binary relations
as used by assoc.
(setq values '((x . 100) (y . 200) (z . 50))) => ((X . 100) (Y . 200) (Z
. 50))
(assoc 'y values) => (Y . 200)
I do not understand this reply. Are you really mixing S-expr syntatic
operators with LISP expr functional operators?
I think i do not said that (A . B) was a list, said I?
(A B C D) <==> (A . (B . (C . (D. NIL))))
The List notation is just a convenience was introduced in early LISP
because working directly with the dot notation was too complex in most
of cases. Also the dot notation contains more, many more, parentheses
:]
Both dot operator and delimiter operator (just space in modern lisps
but ', space' in original LISP) _are_ *infix operators* of the
underlying _S-expr syntax_ because both are in the middle of arguments.
Of course, spaces and dots are not operators of the LISP expr, which
only can be prefix. But is not i was saying. There even an Unicode
operator for this i am saying called "invisible comma".
The LISP (A B) old LISP (A, B) is <(> <A> <invisible comma> <B> <)>
Moreover, one would notice that the current LISP syntax for lists (A B
C) using just space can be ambiguous:
(p "there are two")
is a list of two elements, not four! In original LISP syntax one can
avoid _that_ syntatic ambiguity:
(p, "there are two")
Interestingly, one cannot tokenize the modern LISP notation using a
simple split(' '). One can in CanonML
.
- Follow-Ups:
- Re: What about these?
- From: John Thingstad
- Re: What about these?
- From: Juan R.
- Re: What about these?
- References:
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: John Thingstad
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Thomas A. Russ
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Tim X
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Tim X
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Tim X
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Tim X
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Andy Freeman
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: Andy Freeman
- Re: What about these?
- From: Juan R.
- Re: What about these?
- From: John Thingstad
- Re: What about these?
- Prev by Date: Re: merits of Lisp vs Python
- Next by Date: Re: What about these?
- Previous by thread: Re: What about these?
- Next by thread: Re: What about these?
- Index(es):
Relevant Pages
|