[Haskell-beginners] Simple Chess Program for Learning FP

Brent Yorgey byorgey at seas.upenn.edu
Tue Jun 1 17:00:47 EDT 2010


On Tue, Jun 01, 2010 at 01:54:38PM -0700, Jordan Cooper wrote:
> 
> Thank you, Daniel and Yitzchak! I think that will be enough to get me
> started. As a general question, at what number of elements does it
> become impractical to use Lists?

It's really not a question of number of elements, but of how you use
the lists.  If you are doing stream-processing sorts of things, you
can even idiomatically and efficiently use lists that are infinitely
long!  What lists are not good for is things where you need to do lots
of indexing, since indexing into a list requires first traversing the
beginning of the list.  However for small lists like 8-element lists,
it really doesn't make much of a difference.  You might now ask: well,
suppose I need to do indexing; at what number of elements does it
become impractical to use lists?  The answer is: it depends, probably
somewhere between 10 and 1 million.  Use lists, and if it's too slow,
you can switch later.

-Brent


More information about the Beginners mailing list