On Sun, Feb 26, 2017 at 08:11:43AM -0900, Christopher Howard wrote:
> (de foo (Lst)
>   # some kind of escape condition usually here
>   (foo (modified-copy Lst)) )
> 
> Where modified-copy is a function that returns a *new* list.
> 
> After, say, the tenth time foo is called, are there now ten lists in memory?

No. As I said, it depends on what is *done* with these lists. As it stands
above in 'foo', all those lists are not referred to by anyone, and are thus
unnecessary overhead which is just garbage collected.


> Rationale: In some cases it feels safer and more natural to implement
> the algorithm as a recursive algorithm where you are always passing
> around modified copies of the data.

No need. Typically you use non-destructive list operations which take care to
copy only as many cells as necessary.

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

Reply via email to