Re: Destructive element modification?

2017-02-25 Thread Alexander Burger
On Sat, Feb 25, 2017 at 09:13:46AM +0200, Mike Pechkin wrote:
> ast start point:
> http://ideone.com/zPndpA
> 
> On Sat, Feb 25, 2017 at 9:01 AM, Christopher Howard <
> christopher.how...@qlfiles.net> wrote:
> 
> > Hi list. How do I *destructively* modify the value of one element in a
> > list? E.g.
> >
> > (setq Lst (1 2 3 4))
> >
> > How do I set the second element to be 10, without creating a new list,
> > and without using "con" to change a lot of the list?

In this concrete case:

   (set (cdr Lst) 10)

or, more generally:

   (set (nth Lst 2) 10)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Destructive element modification?

2017-02-24 Thread Mike Pechkin
ast start point:
http://ideone.com/zPndpA

On Sat, Feb 25, 2017 at 9:01 AM, Christopher Howard <
christopher.how...@qlfiles.net> wrote:

> Hi list. How do I *destructively* modify the value of one element in a
> list? E.g.
>
> (setq Lst (1 2 3 4))
>
> How do I set the second element to be 10, without creating a new list,
> and without using "con" to change a lot of the list?
>
> --
> https://qlfiles.net
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>