Well, as far as that goes, we can shave off a little bit (around 7%) this way:

  combs = mapM (\k->[0..k])

(As a bonus, it's even a bit more cryptic/symbolic, in the fine tradition of APL one-liner character-shavings.)

But who's counting? :) :) :)

  --  Fritz Ruehr

On Aug 11, 2004, at 3:22 PM, Mike Gunter wrote:


Why so long-winded :-)?

  combs = mapM (enumFromTo 0)

        mike

Lyle Kopnicky <[EMAIL PROTECTED]> writes:
...
Here is the
improved version:

combs [] = [[]]
combs (n:r) = [i:cr | i <- [0..n], cr <- combs r]
...
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

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

Reply via email to