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

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon May 14 14:16:02 EDT 2012

They could be identical, but they are different because one set is
about lists and the other is about pairs. The fact that pairs may be
used to implement lists is immaterial.

You should really never use the c[ad]*r functions unless you are
specifically dealing with pairs.


On Mon, May 14, 2012 at 6:20 AM, Harry Spier <vasishtha.spier at gmail.com> wrote:
> The list processing synonyms (first, rest, second etc.) are not
> "exactly" identical to car ,cdr etc.
> car, cdr etc. work on proper and improper lists, but first, rest etc.
> only work on proper lists.
> Is there some reason these synonyms can't be made identical to car,
> cdr etc. so  they also work on improper lists.  For someone new to
> lisp like languages, first and rest etc. seem to make your code so
> much more readable.
> Thanks,
> Harry
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.