Re: altering LOCAL list elements

2017-02-10 Thread Joe Bogner
dean, is this what you are describing? (let L (list 1 2 3) (setq L (append L (4))) (printsp L) ) (1 2 3 4) The key to this is understanding how let works. It restores the prior value after execution. See http://software-lab.de/doc/refL.html#let Defines local variables. The val

Re: altering LOCAL list elements

2017-02-10 Thread Joh-Tob Schäg
Not related to your problem. You might wanna take a look at the 'need function. Furthermore i fail to understand your problem. If picolisp behaves unexpected could you please describe what behavior you expect wjat you get and provide a test case which runs the functions it defines? Alternativly

Re: box? on address

2017-02-10 Thread Joh-Tob Schäg
Hi Regenaxer, I realize that there is no probkem with the evaluation of 'circ?. Could 'later be (miss)used to cause some havick when it writes back data? What about timer triggered code? Am 10.02.2017 22:40 schrieb "Alexander Burger" : > Hi Joh-Tob, > > > Doesn't 'circ? also set the gc bit? > > W

Re: box? on address

2017-02-10 Thread Alexander Burger
Hi Joh-Tob, > Doesn't 'circ? also set the gc bit? Well observed!! That't true, but it is the "other" mark bit. While gc uses the bit in the CDR or (X CDR) 1 # Set mark bit uses 'circ' the one in the CAR of the cell or (A) 1 # Mark > Could it be possible that 'circ? evaluates a term w

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

altering LOCAL list elements

2017-02-10 Thread dean
Hi I've seen that I can alter local/let'd atoms? via inc/dec i.e. (inc 'Some_atom) which gets me a long way... ..but what about list elements? (setq L (0 0 0)) (de doit () #(let L (0 0 0) (setq L (insert '1 (remove '1 L) 2)) (prinl "L is " L) #) ) When I "setq" L this works but

Re: unit testing?

2017-02-10 Thread dean
Hi andreas That looks very good to me...thank you very much indeed! Best Regards Dean On 10 February 2017 at 17:12, wrote: > Hi Dean > > PicoLisp is an interpreted language, so very dynamic. > Therefore, why not just do it with a global flag variable? > > (off *Scaffolding) # do not load scaffo

Re: Segfault with huge list...?

2017-02-10 Thread Lindsay John Lawrence
I think I'll start keeping a list =) of picolisp's pleasant surprises. /Lindsay On Fri, Feb 10, 2017 at 11:06 AM, Joh-Tob Schäg wrote: > Linsday when you want to prevent values from neing printed take a look at > the 'nil function. > >

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: Segfault with huge list...?

2017-02-10 Thread Joh-Tob Schäg
Linsday when you want to prevent values from neing printed take a look at the 'nil function. Am 10.02.2017 19:44 schrieb "Lindsay John Lawrence" < lawrence.lindsayj...@gmail.com>: > If it even matters, the overhead of recurse is slowest here. > So impressive that picolisp can iterate/recurse over

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: box? on address

2017-02-10 Thread Joh-Tob Schäg
Doesn't 'circ? also set the gc bit? Could it be possible that 'circ? evaluates a term which accesses something with a changed pointer? Am 10.02.2017 18:12 schrieb "Alexander Burger" : > H Danilo, > > > Please take a quick look at [path "@doc64/structures"] and > > source code of `car' and `val'. >

Re: Segfault with huge list...?

2017-02-10 Thread Lindsay John Lawrence
If it even matters, the overhead of recurse is slowest here. So impressive that picolisp can iterate/recurse over a 10M element list in these times. (VirtualBox VM, 4GB, 1Core, with 64bit Debian). .. and 'make' is a lot more useful that I first realized. /Lindsay # Iterative (de sumi (L) (let

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: unit testing?

2017-02-10 Thread andreas
Hi Dean PicoLisp is an interpreted language, so very dynamic. Therefore, why not just do it with a global flag variable? (off *Scaffolding) # do not load scaffolding ... (de myCode ...) (when *Scaffolding (de myScaffoldingFunc1 ...) (de myScaffoldingFunc2 ...) (de myScaffoldingFunc

Re: box? on address

2017-02-10 Thread Alexander Burger
H Danilo, > Please take a quick look at [path "@doc64/structures"] and > source code of `car' and `val'. > > I am not sure what will happen if GC bit is 1. This is a good question. The interpreter would crash with a bus error. Fortunately this won't happen because this bit is guaranteed to be se

Re: binding free symbols in a lambda definition

2017-02-10 Thread Alexander Burger
Hi Lindsay, > # append > : (bench (let (N ()) (for X 1 (setq N (append N '(NIL (length N))) > 0.548 sec > -> 1 > > # cons > : (bench (let (N '()) (for X 1 (setq N (cons NIL N))) (length N))) > 0.000 sec > -> 1 'append' in such a loop is a lot slower than a straightforward 'co

Re: Segfault with huge list...?

2017-02-10 Thread Mike Pechkin
yea On Fri, Feb 10, 2017 at 5:21 PM, Joh-Tob Schäg wrote: > (de natsum (N) > (if (=0 N) > 0 > ( + N > ( natsum ( dec N) > > Like that? > Am 10.02.2017 15:28 schrieb "Mike Pechkin" : > >> hi, >> >> On Fri, Feb 10, 2017 at 3:07 PM, Christopher Howard < >> christopher.how..

Re: Segfault with huge list...?

2017-02-10 Thread Joh-Tob Schäg
(de natsum (N) (if (=0 N) 0 ( + N ( natsum ( dec N) Like that? Am 10.02.2017 15:28 schrieb "Mike Pechkin" : > hi, > > On Fri, Feb 10, 2017 at 3:07 PM, Christopher Howard < > christopher.how...@qlfiles.net> wrote: > > > Hi list. When I try to do > > > > (apply '+ (range 1

Re: Segfault with huge list...?

2017-02-10 Thread Mike Pechkin
hi, On Fri, Feb 10, 2017 at 3:07 PM, Christopher Howard < christopher.how...@qlfiles.net> wrote: > Hi list. When I try to do > > (apply '+ (range 1 100) > ​List of ​millions of items is not a problem. Problem how you use it. (apply) is not for free, ​It *creates*​ a function call with a mil

Re: binding free symbols in a lambda definition

2017-02-10 Thread Joh-Tob Schäg
Why not "(de myf FList (apply (car Flist) (cdr Flist))"? Am 08.02.2017 05:04 schrieb "pd" : > Hello, > > I wonder if there is any way to bind a free symbol in a lambda in order to > pass the lambda to a defined function (for example) > > What I want to do is something like this: > > (de myf (

Re: Segfault with huge list...?

2017-02-10 Thread Joh-Tob Schäg
That sounds very plausible. Am 10.02.2017 14:35 schrieb "Joe Bogner" : > It sounds like it's exceeding the stack size. Have you tried setting it to > unlimited? ulimit -s unlimited > > http://www.mail-archive.com/picolisp@software-lab.de/msg01203.html > > On Fri, Feb 10, 2017 at 8:07 AM, Christoph

Re: Segfault with huge list...?

2017-02-10 Thread Joe Bogner
It sounds like it's exceeding the stack size. Have you tried setting it to unlimited? ulimit -s unlimited http://www.mail-archive.com/picolisp@software-lab.de/msg01203.html On Fri, Feb 10, 2017 at 8:07 AM, Christopher Howard < christopher.how...@qlfiles.net> wrote: > Hi list. When I try to do >

Re: Segfault with huge list...?

2017-02-10 Thread Joh-Tob Schäg
Maybe you want to try (nil (range 1 100)) and see if the problem is there. Am 10.02.2017 14:24 schrieb "Joh-Tob Schäg" : > I had a similar experience. It tends to happen if you allocate to much at > once. Should be around 16 Megabyte in this case which normally is no > problem. > > If you have

Re: Segfault with huge list...?

2017-02-10 Thread Joh-Tob Schäg
I had a similar experience. It tends to happen if you allocate to much at once. Should be around 16 Megabyte in this case which normally is no problem. If you have such a long list and want to apply functions to it I would use generators instead. They are less ram intensive. You do things wrong.

Segfault with huge list...?

2017-02-10 Thread Christopher Howard
Hi list. When I try to do (apply '+ (range 1 100) I get segfault. I thought maybe this was some kind of internal limitation of the apply function, so I defined a foldl: (de foldl (Fn Acc Lst) (if (== () Lst) Acc (let Acc2 (Fn Acc (car Lst)) (foldl Fn Acc2 (cdr Lst))

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: box? on address

2017-02-10 Thread pd
Hi Danilo Isn't [doc 'car] clear enough? > clear as an unmuddied lake ;-) doc should be read because reading it makes guessing innecesary ;-) > > Please take a quick look at [path "@doc64/structures"] and > source code of `car' and `val'. > > I am not sure what will happen if GC bit is 1. >

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: box? on address

2017-02-10 Thread Danilo Kordic
A few more examples: : [setq S1 "A"] -> "A" : (box? S1) -> NIL : (name S1 "") -> "NIL" # ?! : S1 -> "NIL" : (name NIL) -> NIL # ?! : (name 'S1) -> "S1" : [setq B1 [box 'val]] -> $177002116445201 : (val B1) -> val : (name B1) -> NIL : (name S1 B1) -> $177002116444132 : (name S1) -> NIL : (box? S