I tried conc to an empty list on both 32 and 64 bit versions of picolisp
I even installed SBCL just to try the similar 'nconc' on that platform.

The results are consistent for all of them.
I  just don't understand why.... Is it simply 'standard', historical
reasons? because of the way evaluation works?

As it is, I would not be able to build a list 'destructively' without
conditional logic for the initial empty list.
conc works as expected when M is not empty. i.e M is rewritten.


# --------------------------------------------
# Could also use NIL to represent the empty list (
http://software-lab.de/doc/ref.html#nilSym)
: (setq M '() N '(A B C))
-> (A B C)
: (conc M N)
-> (A B C)
: M
-> NIL
: N
-> (A B C)

# This is even weirder to me...
# Again, I expected M, not N, to be rewritten
: (setq M NIL N '(A B C) L '(1 2 3))
-> (1 2 3)
: (conc M N L)
-> (A B C 1 2 3)
: M
-> NIL
: N
-> (A B C 1 2 3)
: L
-> (1 2 3)
# ---------------------------------------------

/Lindsay

Reply via email to