Tue, 25 Jan 2000 09:51:15 -0500, Chris Okasaki <[EMAIL PROTECTED]> pisze:
> For the people that share this sentiment, can you please explain
> why ints that are too big should not similarly give an error?
> I can see both being ok, or both being errors. I just don't see
> why one should be ok and the other an error.
If what others said was not convincing enough, and if the answer
"because you can't easily simulate the present version using the new
version (and you can easily simulate various treatments of negative
values)" is not enough:
Think about a list [1,2,3] as representing
Just 1 : Just 2 : Just 3 : repeat Nothing
(where you can be always sure that after the first Nothing there
are no more Justs). Then everything works, there is no such thing as
"too big index"...
...except that tail [] gives an error instead of [] again. Ugh.
Surprisingly, I still feel that this is OK, probably because tail is
a fundamental enough concept (data [a] = [] | (:) {head :: a, tail ::
[a]}) that it should operate on a physical model of a list, the other
version is easily simulated, and I believe tail is more often used
in contexts where tail [] is a bug.
Haskell changed a bit my thinking about the concept of a list :-)
Previously a list was a horizontal line with the beginning and the end
which were quite symmetric. We could examine it at once as a whole
and iterate through it back and forth. It was similar to an array,
possibly only with a different physical representation allowing
insertions of elements at any place.
Now we hold at hand only its beginning along with a few elements that
we managed to look at closer. The rest is floating somewhere around,
possibly very far away. We can't see it until we pull it, and it
floats away when we release it - be careful not to lose it! And it
may simply end at some place, or be infinite, or contain poisoned
bottoms - we don't know until we go along it and check. It's certainly
not symmetric.
--
__("< 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-