[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: LAST-N (Version 1)
- To: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: Issue: LAST-N (Version 1)
- From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Fri, 4 Dec 87 18:35 EST
- Cc: CL-Cleanup@SAIL.STANFORD.EDU
- In-reply-to: <871204164910.9.KMP@RIO-DE-JANEIRO.SCRC.Symbolics.COM>
Date: Fri, 4 Dec 87 16:49 EST
From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
Issue: LAST-N
References: LAST (p267)
Category: ENHANCEMENT
Edit history: 04-Dec-87, Version 1 by Pitman
Proposal (LAST-N:ALLOW-OPTIONAL-ARGUMENT):
Allow LAST to take an optional argument N, saying how many cells to return.
You should say explicitly that the default for N is 1.
The following two paragraphs cannot be correct. For example, think about
(last '(a)), which you are saying returns nil.
If N is equal to the number of cons cells in the list L, then the atom which
terminates the list L is returned.
If N is greater than the number of cons cells in the list L, then it is an
error if the list is not a proper list. If in this case the list is a proper
list, then L is returned.
I think what you really mean is
If N is zero, then the atom that terminates the list L is returned.
If N is greater than or equal to the number of cons cells in
the list L, then the result is L.
This correction makes it consistent with your examples.
With these corrections, I don't oppose the proposal. I'm not strongly in
favor of it, since I put less priority on enhancements than on correcting
mistakes in what we've got already. I'll favor it if others do.