On Fri, Feb 10, 2017 at 10:31:20AM +0100, pd wrote: > On Fri, Feb 10, 2017 at 6:47 AM, Lindsay John Lawrence < > > 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 would be great if you explain how it works, at least for me since I > cannot understand why 2. returns NIL rather than (A)
'conc' is the destructive version of 'append'. Right Lindsay, this is called "nconc" in other versions of Lisp. There was the convention - for some obscure reason - to put an "n" in front of the names of destructive list operations: nconc, nreverse, ndelete ... 'conc' traverses each list argument and puts the next argument into the CDR of the last cell: : (conc (1 2) (3)) -> (1 2 3) This has the consequence that if the last arg is atomic : (conc (1 2) 'a) -> (1 2 . a) that atom is of course stored in that last CDR. Now, if yet another argument follows, this last CDR gets overwritten : (conc (1 2) 'a (3)) -> (1 2 3) So as a result atomic arguments are simply lost. This happens also if the atom is the first argument : (conc 'a (1 2)) -> (1 2) BTW, all the above applies to 'append' as well. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe