Hi Alex,

as we discussed recently, I have tried how Common Lisp handles dot and
it allows dot as part of a symbol name.

In PicoLisp, the dot is special and reader gives a bit "inconsistent"
results:

: .
-> NIL
: .2
-> NIL
: .a
-> NIL
: (1 .2)
-> (1 . 2)
: (1 .hi)
-> (1 . hi)
: (1.2)
-> (1)
: 

You were right that a picolisp number cannot just start with a dot.

In Common Lisp, I can do:

CL-USER> (defun .b (x) (1+ x))
B
CL-USER> (.b 2)
3

CL-USER> 'a.b
A.B

CL-USER> a.b
EVAL: variable A.B has no value
   [Condition of type SYSTEM::SIMPLE-UNBOUND-VARIABLE]

CL-USER> '(a     .    b)
(A . B)
CL-USER> (length '(a     .    b))
LENGTH: A proper list must not end with B
   [Condition of type SIMPLE-TYPE-ERROR]

CL-USER> '(a.b)
(A.B)
CL-USER> (length '(a.b))
1

CL-USER> .23
0.23
CL-USER> '(1.(2.3))
(1 (2.3))
CL-USER> '(1 .(2.3))
(1 2.3)
CL-USER> '(1 .(2 .3))
(1 2 0.3)
CL-USER> '(1 .(2 . 3))
(1 2 . 3)

In other words, the dot inside a list must be on its own (separated by
whitespace) to have the "cons" meaning.  I think that Common Lisp
behaviour "makes more sense" in this regard and is "less restrictive".

Regards,

Tomas
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to