Tue, 2 Nov 1999 12:59:58 -0800 (PST), Ronald J. Legere <[EMAIL PROTECTED]> pisze:
> BTW, I know about the array type. Actually I dont understand it
> very well though. Between looking at the source and the docs, i
> still cant see how it is meant to be used. I would love to look at
> an example.
Arrays can be supposed to offer constant time access to elements by
their indices. Haskell report does not guarantee such things formally,
but in practice it should be true.
For example when rendering the plasma fractal, we want to fetch
previously computed pixels' values by arbitrary indices. Doing it on
list of lists would also work, but would be slower.
Lists are better when elements are used and produced sequentially,
or when the length is not known or infinite. Arrays are better when
we access elements by random indices or have to produce them in random
order, but we must know the bounds in advance.
--
__("< 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-