Re: Lifespan of memory of parameters

2017-02-26 Thread Alexander Burger
On Sun, Feb 26, 2017 at 08:31:37AM +0100, Alexander Burger wrote: > (let A (bar (copy Lst)) > (off Lst) > (doSomethingWithTheCopy) > ... > > With (off Lst) *one* refernce to the list is cleared, but the list will be > garbage collected only when the *last* referenc

Copy/Clone a 'job

2017-02-26 Thread Lindsay John Lawrence
Hi, How would I copy|clone, reinitialize or dispose of a 'job' function? For example, given (de hexSpigot NIL (job '((N)) (ifn N (setq N '(0))) (prog1 (hex (% (car N) 16)) (setq N (cons (+ 1 (car N)) N)) ) ) ) I can then do.. : (do 32 (prin (hexSpigot))) 01234

Re: Copy/Clone a 'job

2017-02-26 Thread Alexander Burger
Hi Lindsay, > (de hexSpigot NIL >(job '((N)) > ... > : (do 32 (prin (hexSpigot))) > ... > 0123456789ABCDEF0123456789ABCDEF-> "F" > ... > : (pp 'hexSpigot) > (de hexSpigot NIL >(job > '((N 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 > 11 10 9 8 7 6 5 4 3 2 1 0 ) )

Re: Copy/Clone a 'job

2017-02-26 Thread Lindsay John Lawrence
Thanks Alex, I'll have to play with your solution a bit. I don't quite follow how the global is working there in conjunction with 'job and 'off. However, after banging around on this for a couple of hours, trying 'copy', various auxillary functions to return the quoted 'job, etc I was at my wits

Re: Copy/Clone a 'job

2017-02-26 Thread Alexander Burger
Hi Lindsay, > I'll have to play with your solution a bit. I don't quite follow how the > global is working there in conjunction with 'job and 'off. There is nothing mysterious about it. 'job' evaluates its first argument. So there is absolutely no difference whether you quote that argument (

Re: Copy/Clone a 'job

2017-02-26 Thread Joe Bogner
Hi Lindsay, It looks like you are using job primarily to retain the value of N between invocations. Is that true? Just curious, why not move the loop inside of hexSpigot instead of looping outside of it? Another option to consider if you want the behavior of being able to increment the hexSpigot a

Re: BBWT

2017-02-26 Thread Rick Hanson
A bit off-topic, but I like how this transformation On 25 Feb 2017, 09:40:43 +0100, Alexander Burger wrote: >(if (not (cdr W)) > (Put C (car W)) > (Put (car (cdr W)) (car W)) ) > -> >(Put > (ifn (cdr W) C (cadr W)) > (car W) ) reminds me of factoring in high school

Re: BBWT

2017-02-26 Thread Joh-Tob Schäg
> Yes, gotta love lisp for the ability to do this (and other things). :) > But more often than not this features are not required in practice. Sadly it is just cool and not significant. :( 2017-02-26 17:06 GMT+01:00 Rick Hanson : > A bit off-topic, but I like how this transformation > > On 25 F

Re: Lifespan of memory of parameters

2017-02-26 Thread Christopher Howard
Thanks for the quick reply, and the great info I get on this list. Maybe more to the point would be a function like so: (de foo (Lst) # some kind of escape condition usually here (foo (modified-copy Lst)) ) Where modified-copy is a function that returns a *new* list. After, say, the tenth ti

Re: Lifespan of memory of parameters

2017-02-26 Thread Alexander Burger
On Sun, Feb 26, 2017 at 08:11:43AM -0900, Christopher Howard wrote: > (de foo (Lst) > # some kind of escape condition usually here > (foo (modified-copy Lst)) ) > > Where modified-copy is a function that returns a *new* list. > > After, say, the tenth time foo is called, are there now ten lis

Re: BBWT

2017-02-26 Thread Alexander Burger
On Sun, Feb 26, 2017 at 06:00:28PM +0100, Joh-Tob Schäg wrote: > > Yes, gotta love lisp for the ability to do this (and other things). :) > > > But more often than not this features are not required in practice. Sadly > it is just cool and not significant. :( I would say it is very significant. F

Re: Copy/Clone a 'job

2017-02-26 Thread Lindsay John Lawrence
Thanks for the suggestion Joe. Other than copy-paste examples, I haven't played much with either #oop and #dbase in picolisp. It is definitely on my list ;) I've been trying to get a good understanding of variable scope, state and lifetime. Especially with functions that have the side-effect of m

Re: Future of PicoLisp?

2017-02-26 Thread Edgaras
Just a lurker passing by: Personally I'm much less excited about things like pip or node.js packages. While I get their appeal often times you end up with quite a nonses like node.js left-pad issue of year or so ago. In my eyes it promotes a kinda of "shatered into milion pieces" situation. I'm mu