Recursion-Loop Macro?

2017-02-11 Thread Christopher Howard
Hi list. I got the impression from some of the documentation that we aren't planning to implement TCO in picoLisp, and that the preferred approach is to just use a loop. I don't want to argue against that, but I was just wondering if perhaps somebody had a macro that made a loop look like a

Re: altering LOCAL list elements

2017-02-11 Thread dean
Hi Joh-tob & Joe With setq L.(0 0 0) gets changed to (2 0 0) i.e. the replace is done by index not matching value With let L...(0 0 0) stays at (0 0 0) I'd wanted the former in conjunction with let. Thank you for the suggestion re need...and the explanation re let. I can do this with setq but

Re: altering LOCAL list elements

2017-02-11 Thread dean
Here's the desired behaviour using the above code : (setq L (0 0 0)) -> (0 0 0) : (de doit () #(let L (0 0 0) (setq L (insert '1 (remove '1 L) 2)) (prinl "L is " L) #) ) -> doit : (doit) L is 200 -> (2 0 0) I was after (2 0 0) using let L i.e. the two lines commented out which

Re: altering LOCAL list elements

2017-02-11 Thread dean
This works too but I really want to remove setq from the middle of doit : (de doit () (let L (0 0 0) (setq L (insert '1 (remove '1 L) 2)) (prinl "L is " L) ) ) -> doit : (doit) L is 200 -> (2 0 0) On 11 February 2017 at 10:29, dean wrote: > Here's

Re: altering LOCAL list elements

2017-02-11 Thread dean
and use a local solution but don't think that I can On 11 February 2017 at 10:38, dean wrote: > This works too but I really want to remove setq from the middle of doit > > : (de doit () >(let L (0 0 0) > (setq L (insert '1 (remove '1 L) 2)) > (prinl "L

Re: altering LOCAL list elements

2017-02-11 Thread dean
BTW I left setq in the midlle of doit by accident...i.e I used it to work out how to replace a list element by index not value as per the built-in replace. On 11 February 2017 at 10:38, dean wrote: > and use a local solution but don't think that I can > > On 11

Re: altering LOCAL list elements

2017-02-11 Thread Joh-Tob Schäg
I understand your problem now. You have think about cells in this case. When you inc a 'symbol the value part of the symbol-cell is changed. [prop|val] represents a symbol in this case. (inc '[NIL|5]) is [NIL|6] The Symbol was changed destructivly. All earlier refernces to this cell now evaluate

Unsubscribe

2017-02-11 Thread deadbrain
Good bye deadbrain :-( You are now unsubscribed -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Unsubscribe

2017-02-11 Thread Brad Collins
Good bye Brad Collins :-( You are now unsubscribed I'll be back -- Brad Collins +855 010628234 | b...@chenla.la | Cambodia twitter: http://twitter.com/deerpig | github: http://github.com/deerpig -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Re: altering LOCAL list elements

2017-02-11 Thread Joh-Tob Schäg
You can also explicitly change the car or cdr of a list cell. If you do a little diging in the docs you might find the functions. Am 11.02.2017 12:45 schrieb "dean" : > >Does that explanation make sense? > > Yes it does > > >You can either destructivly change the car of

Re: altering LOCAL list elements

2017-02-11 Thread dean
>Does that explanation make sense? Yes it does >You can either destructivly change the car of a cell in the list or write your own pop which keeps the same >cell at the head of the list (by reassigning car parts appropiatly). Thank you...this is the only way I know about at the moment that lets

Re: altering LOCAL list elements

2017-02-11 Thread dean
Thank you On 11 February 2017 at 11:51, Joh-Tob Schäg wrote: > You can also explicitly change the car or cdr of a list cell. > If you do a little diging in the docs you might find the functions. > Am 11.02.2017 12:45 schrieb "dean" : > > > >Does