[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What should LAST of an atom do? -- conclusion

    Date: Sunday, 10 April 1983, 22:30-EST
    From: David A. Moon <MOON%SCRC-TENEX@MIT-MC>
    On page 176 of the Laser edition of the Common Lisp manual, it says
    that LAST of the empty list should return NIL.  It doesn't say anything
    about LAST of other atoms.

    The question is: should LAST be redefined to be an error when applied to
    an atom, since anything it could return would really be wrong?  And
    should it be an error even if the atom is NIL?

    Date: Sun, 10 Apr 1983  23:55 EST
    From: Scott E. Fahlman <Fahlman@CMU-CS-C>
    I don't feel very strongly about this, but I would go for (LAST NIL) ==>
    NIL and LAST of any other atom being an error.  This is nice to
    implement and feels right to me, given that (CDR NIL) ==> NIL and
    (CDR non-null-atom) is an error.

    Date: 11 April 1983 03:43 EST
    From: Glenn S. Burke <GSB @ MIT-ML>
    At one point, in NIL it did not accept anything but a cons.
    I found that to be giving me a hard time (i don't remember where,
    it may have been some NIL-only loop expansions in part), so i changed
    it to accept an argument of NIL and return that.

I don't completely buy the reasoning that (LAST NIL) shouldn't be an error.
But I'll go along with it.  Unless anyone wants to dispute, the conclusion
is that LAST of anything that is LISTP is valid, and LAST of anything else
is an error, and the Lisp machine is broken and will be fixed to detect
the error rather than returning NIL.  The CL manual should be clarified.