[Haskell-cafe] Re: Shouldn't this loop indefinitely => take (last [0..]) [0..]

Ketil Malde ketil at malde.org
Fri Apr 4 14:54:04 EDT 2008


"Neil Mitchell" <ndmitchell at gmail.com> writes:

>>  length, take, drop and index working on machine-sized Ints by default
>>  are really a bit of a wart, aren't they?

> Yes. Also, having strict Int's by default is a bit ugly,
  [..]
> (Not that it isn't a worthwhile trade off, but it is still loosing
> something to gain something else)

Presumably you refer to the latter point - Int strictness - here?  I
don't think "optimizing" list operations (take, length etc) to Int
buys you much performance - traversing the list is going to be far
more expensive.  (Or so I believe - anybody care to benchmark it?)

Unfortunately, the "genericLenght" name is about as clumsy
syntactically as Int is semantically, so it's about an even trade-off
:-)  

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list