Yes, you couldn't reuse the same initial value for a data structure like
you would in scheme

On Tue, Oct 9, 2018, 12:15 PM Alexander Burger <[email protected]> wrote:

> > On Tue, Oct 9, 2018, 10:30 AM Mike <[email protected]> wrote:
> >
> > > hi all,
> > >
> > > My demo code to mimic racket's reference:
> > > https://bitbucket.org/mihailp/tankfeeder/src/default/foldl.l
>
> Perfect!
>
>
> On Tue, Oct 09, 2018 at 10:57:43AM -0400, John Duncan wrote:
> > Isn't it destructive to I?
>
> You mean the line (setq I (apply F (conc (rest) (cons I))))? Not in the
> sense
> "destructive" is used in the context of PicoLisp. Here only the value of
> 'I' is
> modified.
>
> The term "destructive" is used if cell structures are modified as a side
> effect.
> For example, 'conc' in general is destructive:
>
>    : (setq A (1 2 3))
>    -> (1 2 3)
>
>    : (conc A (4 5 6))   # Concatenate lists
>    -> (1 2 3 4 5 6)
>
>    : A
>    -> (1 2 3 4 5 6)     # The list in 'A' is destructively modified
>
>
> However, the 'conc' in the above (conc (rest) (cons I)) is all right,
> because it
> modifies only the list returned by (rest), which is a "fresh" list (just
> created
> newly and not referred to by any other place).
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
>

Reply via email to