[racket-dev] first and rest in racket/base

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Thu Dec 13 15:24:12 EST 2012

At Thu, 13 Dec 2012 14:51:42 -0500,
Eli Barzilay wrote:
> A few minutes ago, Jay McCarthy wrote:
> > I agree with Eli. first is not car and shouldn't be treated as it.
> > 
> > car : (Cons a b) -> a
> > first : (List a) -> a
> 
> Right -- it's a different type, and the `list?' check adds a cost.
> 
> I don't have too much problem with how they are now -- it's just that
> moving them to the base language makes it easier to think that they're
> the same thing, even more in the presence of the CL thing (where they
> are the same).

`racket/base' already has both `pair?' and `list?', and I don't think
anyone is getting confused. `#lang racket' has all of them, and that
does not seem to cause any issues either.

I could amend my patch to move the documentation of `first' and `rest'
with the other list operations in `racket/base' (`length', `list-ref',
etc.) instead of with `car' and `cdr'. Do you think that would help?

Vincent

Posted on the dev mailing list.