Re: conc: unexpected results

2017-02-10 Thread Alexander Burger
On Fri, Feb 10, 2017 at 08:32:06PM +0100, Pierpaolo Bernardi wrote: > On Fri, Feb 10, 2017 at 6:24 PM, Alexander Burger > wrote: > > > 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 name

Re: conc: unexpected results

2017-02-10 Thread Pierpaolo Bernardi
On Fri, Feb 10, 2017 at 6:24 PM, Alexander Burger wrote: > 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 ... In case someone wo

Re: conc: unexpected results

2017-02-10 Thread Lindsay John Lawrence
Hi Danilo, Your example helped. I can reason with (conc equences) now =) /Lindsay > AFAIK there is only one empty `list' in PL, and that is `NIL'. So > after `conc'atenating to it's end it would no longer be empty. > > [de ex2 [] > [let [R [list]] > [do 10 > [conc R [list 'A]] ] >

Re: conc: unexpected results

2017-02-10 Thread Lindsay John Lawrence
Thank you Alex. Your explanation of atomic arguments is particularly enlightening. /Lindsay > 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) > >

Re: conc: unexpected results

2017-02-10 Thread Alexander Burger
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 understan

Re: conc: unexpected results

2017-02-10 Thread pd
On Fri, Feb 10, 2017 at 6:47 AM, Lindsay John Lawrence < lawrence.lindsayj...@gmail.com> wrote: > > 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

Re: conc: unexpected results

2017-02-10 Thread Danilo Kordic
Hi Lindsay. AFAIK there is only one empty `list' in PL, and that is `NIL'. So after `conc'atenating to it's end it would no longer be empty. How about: [de ex1 [] [make [do 10 [link 'A] ] ] ] [de ex2 [] [let [R [list]] [do 10 [conc R [list 'A]] ] # Will have to

Re: conc: unexpected results

2017-02-09 Thread 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 seems that it is not often used in everyday programming: "It is a good idea to leave the use of NCO

Re: conc: unexpected results

2017-02-09 Thread Lindsay John Lawrence
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 w

conc: unexpected results

2017-02-09 Thread Lindsay John Lawrence
conc does not rewrite N if N is an empty list. # 1. : (let (N '()) (conc N '(A))) -> (A) # 2 : (let (N '()) (conc N '(A)) N) -> NIL # 3. : (let (N '(NIL)) (conc N '(A)) N) -> (NIL A) # 4. : (let (N '()) (setq N (conc N '(A))) N) -> (A) In #2 above, I was expecting N to be (A) If N is not empty, a