issue with circular lists

2020-12-23 Thread Davide BERTOLOTTO
Hi everyone, I had recently an issue with both pil64 and pil21. I was trying to create a large circular list and got a segmentation fault with a size of >200'000 elements. Is that expected? (apply circ (range 1 20)) Regards, Davide

Re: issue with circular lists

2020-12-23 Thread Davide BERTOLOTTO
Just found out that it is an issue with apply. Probably the number of arguments is too large. (eval (cons 'circ (range 1 20))) Works fine. Could someone confirm please? Regards Davide On Wed, Dec 23, 2020, 13:16 Davide BERTOLOTTO wrote: > Hi everyone, > > I had recently an issue with

Re: issue with circular lists

2020-12-23 Thread Alexander Burger
On Wed, Dec 23, 2020 at 01:57:10PM +0100, Alexander Burger wrote: > The result is a little different though: > >: (let L NIL (for I 7 (fifo 'L I)) L) >-> (7 1 2 3 4 5 6 .) .. but of course the fix is trivial :) : (cdr (let L NIL (for I 7 (fifo 'L I)) L)) -> (1 2 3 4 5 6 7 .) ☺/

Re: issue with circular lists

2020-12-23 Thread Davide BERTOLOTTO
Thanks for the clarification Alex! The ulimit command did the trick. Cheers, Davide On Wed, Dec 23, 2020, 14:16 Alexander Burger wrote: > On Wed, Dec 23, 2020 at 01:57:10PM +0100, Alexander Burger wrote: > > The result is a little different though: > > > >: (let L NIL (for I 7 (fifo 'L I))

Re: issue with circular lists

2020-12-23 Thread Alexander Burger
Hi Davide, > Just found out that it is an issue with apply. Probably the number of > arguments is too large. > > (eval (cons 'circ (range 1 20))) Yes, this is a known issue. It is a stack overflow. 'apply' builds structures on the stack. The recommended way is to set ulimit -s

Re: issue with circular lists

2020-12-23 Thread Alexander Burger
On Wed, Dec 23, 2020 at 01:35:58PM +0100, Alexander Burger wrote: > > (eval (cons 'circ (range 1 20))) > Yes, this is a known issue. It is a stack overflow. Building a long list with 'range' just to apply it (e.g. to 'circ') is rather inefficient. In this case, I would recommend 'fifo' to