Hi
This was my original version plus some modifications as advised by the list:
f c = sum [1 | x <- ['\0'..], x < c]

The following version was sent by a list member:
f c = length $ takeWhile (<c) ['\0'..]

Now, the sender asserted that the first version was much too slow. I'm wondering how the second version is any more efficient than the first. Looking at them through my C programmers' eye, as it were, both would require at least two loops before returning the ANSI value.
Any ideas?
Thanks, Paul

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to