[racket] first and rest etc. only work on proper lists

From: Pierpaolo Bernardi (olopierpa at gmail.com)
Date: Tue May 15 08:12:40 EDT 2012

On Tue, May 15, 2012 at 1:49 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Tue, 15 May 2012 06:31:13 -0500, Robby Findler wrote:
>> FWIW, the list? check that is inside first and rest caches its result
>> in the header information in the cons cells it traverses.
>
> In other words, `first and `rest' are amortized constant-time, due to
> the use of the amortized constant-time `list?'.

Thanks for the extended comment.

So, this is another advantage of immutable conses that I had not tought of.

Cheers
P.

Posted on the users mailing list.