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
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
>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
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
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
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
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
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
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
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
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
11 matches
Mail list logo