Apologies for bothering everyone with this. It took some research (there is
surprising little discussion of the function online or even in most books),
but I at least understand how it works now.

It seems that it is not often used in everyday programming: "It is a good
idea to leave the use of NCONC, RPLACA, RPLACD, and DELETE to risk-loving
programmers. Unless desperate for time or space saving, using them just
leads to unnecessary bugs. "--Lisp (Winston, Horn) P. 117

/Lindsay


On Thu, Feb 9, 2017 at 5:21 PM, Lindsay John Lawrence <
lawrence.lindsayj...@gmail.com> wrote:

> 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