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 was just wondering if there was a way around
"setting" let'd values more than once...like you can with let'd
atoms...using inc and dec.
I don't think you can but didn't think you could with atoms until inc and
dec came back as an answer on this forum...hence this question :).
Thank you for your advice and best regards
Dean



On 11 February 2017 at 02:07, Joe Bogner <joebog...@gmail.com> wrote:

> 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 value of the symbol sym - or the values of
> the symbols sym in the list of the second form - ***are saved** and the
> symbols are bound to the evaluated any arguments. The 64-bit version also
> accepts lst arguments in the second form; they may consist only of symbols
> and sublists, and match the any argument (destructuring bind). prg is
> executed, then the symbols ***are restored to their original values***.
>
>
>
> On Fri, Feb 10, 2017 at 3:22 PM, dean <deangwillia...@gmail.com> wrote:
>
>> 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 can I do it (somehow) when L is created
>> with "let"?
>>
>
>

Reply via email to