[plt-scheme] append!?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Oct 22 09:27:20 EDT 2007

And now you have lost _everything_ from the (huge) standard library  
from Scheme. This kind of loss tends to suggest a programming style  
that goes against the grain of the intended design style. You may to  
ponder this implication. -- Matthias



On Oct 21, 2007, at 10:22 PM, Majorinc, Kazimir wrote:

> Robert Nikander wrote:
>>
>> On Oct 21, 2007, at 6:45 PM, Majorinc, Kazimir wrote:
>>>
>>> type list is record
>>>   next: (pointer to node) or NIL;
>>> end
>>> type node is record
>>>  data: pointer to anything;
>>>  next: (pointer to node) or NIL
>>> end
>>>
>> It sounds like the problems you are talking about come from trying  
>> to write imperative style in the functional language.
>>
>> The type above is a problem for recursive functions because "next"  
>> is not a list, so you can't process the first item and recurse on  
>> the rest.
> L.next is not a list, but I think one can easily define procedure  
> like (rest L) that does equivalent to what it does now in Scheme  
> and can serve as the base of recursion. This rest procedure would  
> have to create new list record each time it is called, but I do not  
> see anything particularly wrong in that. In the case I  
> misunderstood you and you suggest this one:
>
> type list is record
>  next: (pointer to node) or NIL;
> end
> type node is record
> data: pointer to anything;
> rest: list;
> end
>
> right, its even more powerful. With such implementation (empty!  
> (rest L)) would be equivalent to (set-rest! L ()). wow!
>
>
>
>
>
>
>
>
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.