Tue, 18 Jan 2000 13:46:27 +0100, Jan Kort <[EMAIL PROTECTED]> pisze:
> This minor inconsistency has been bothering me for some time:
>
> Prelude> drop 10 "test"
> ""
> Prelude> drop (-1) ""
> ""
> Prelude> drop (-1) "a"
> "
> Program error: Prelude.drop: negative argument
Hmm, right...
We could argue what should be evaluated first: the beginning of the
list or the count. The count seems to be more natural, because the rest
of the list is certainly evaluated later. This yields your version.
> Secondly, why not an error for an argument that's too big ?
The current behavior can be useful and could not be simulated well
using your version. Trivial example: you want to see what remains
from a text file after scrolling left a few columns and clipping the
right margin to the window width. Present versions of both drop and
take are needed. drop and take mean "drop/take at most that many".
So I would propose failing immediately on negative argument, but
keeping current semantics when the count is too big (or the list
is too short).
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/ GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK 5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-