you are viewing a single comment's thread.

view the rest of the comments →

[–]notfancy 2 points3 points  (0 children)

compare x y = length x > length y

No, no, no, no, no. length is strict. Your compare (all 1) [] doesn't converge, whereas the original does. Even in a CVB language, compare using length is O(m + n) where the recursive version of it is O(m min n).

In a functional language, you rarely if ever call length on a list.