[Haskell-beginners] Important coding guideline and library proposal

Keith Sheppard keithshep at gmail.com
Sun Nov 22 14:43:54 EST 2009


... or just say that it's O(n) in the docs. And if n is infinity
you'll be waiting for a while.

(Sorry Stephen... meant that for the list)

On Sun, Nov 22, 2009 at 2:33 PM, Stephen Tetley
<stephen.tetley at gmail.com> wrote:
> Hi Daniel
>
> Hmm, maybe the docs in Data.List should say that length is recursively
> calculated. I know you can view the source from Haddock, and its also
> obvious once you think of list as being defined by an algebriac type,
> but lists in other languages (read OO) often have track length as part
> of the ADT making it constant time to get hold of.
>
> Best wishes
>
> Stephen
>
>
> 2009/11/22 Daniel Fischer <daniel.is.fischer at web.de>:
>> Guideline:
>>
>> NEVER, *never ever*, use 'length' ***unless you really want to know the exact length of a
>> list***
>>
>> Proposal:
>> rename 'length' to 'yesIReallyWantToKnowTheExactLengthOfThisListSoPleaseCalculateItForMe'
>> to reduce performance bugs caused by naive uses of length.
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
>>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
keithsheppard.name


More information about the Beginners mailing list