On Wed, Dec 15, 2021 at 5:18 PM Alexander Burger <a...@software-lab.de>
wrote:

>
> It is all explained in this article from 2011:
>
>    https://picolisp.com/wiki/?ArticleQuote
>
> So I consider 'quote' in PicoLisp a big improvement over other lisps ;)
>
> interesting point of view but I consider this introduces several drawbacks
just to afford only one cell:

- it breaks compatibility with almost all lisp out there
- it makes a dotted pair or improper list into an application which is not
a right application form in any lisp AFAIK, function application is always
a proper list not a dotted pair

  In all lisp I know you cannot write (+ 1 . 2)  or (quote . a) or (+ . 1),
they all produces an error, the right syntax is (+ 1 . (2)) or (quote .
(a)) or (+ . (1)) because function application must be a proper list not a
improper list

  That is also the case in picolisp, where you can write (quote . a) -> a
but  writing (+ . 1)  produces a Segmentation fault whereas writing (+ .
(1)) -> 1  produces the desired result

  This way the syntax and behaviour in picolist is not internally coherent,
every function application must be a list but for quote, which can be not a
list but an improper list.

examples in picolisp of this strange behaviour:

( + 1) -> 1              ; expected behaviour
(+ . (1)) -> 1          ; expected behaviour
(+ . 1)                   ; Segmentation fault
(+ 1 . 2)  ->  1       ; behaviour not expected, it should be 3 (following
quote) or ERROR
(+ 1 . (2)) -> 3       ; expected behaviour
(+ 1 . (5 . 3)) -> 6  ; behaviour not expected, it should be 9 (following
quote) or ERROR

Last example is interesting, It seems to simply ignore last item assuming
last cell cdr as nil even if it is not

It seems to me that incoherence is because picolisp treats all funcional
applications as every lisp but quote form which is treated in a special way:

(+ . (1)) -> 1             but           (quote . (1)) -> 1
(list 3 . 5) -> (3)        but          (quote 3 . 5) -> (3 . 5)      even
when    (list 3 5) -> (3 5)  and   (quote 3 5) = (quote . (3 5)) -> (3 5)

; with an undefined symbol zz
(print . 'zz)  265606 ->  265606              but   (quote . 'zz) -> 'zz
(print . zz)  NIL->  NIL                             but   (quote . zz) ->
zz
(print  zz)  NIL->  NIL
(print  zz . vv)  NIL->  NIL          ;  again skiping last symbol

I really don't know what is the number 265606 printed and returned when
calling (print . 'zz)

Maybe I'm misunderstanding something.

Reply via email to