Re: [Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread porges
2009/7/17 Gleb Alexeyev : On Jul 17, 2009 1:40pm, Thomas Hartman wrote: my question to all 3 (so far) respondants is, how does your explanation explain that the result is the power set? Because powerset(s) = 2^s? I was going to make some nice code but I ended up with this monster :D {-#

[Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Gleb Alexeyev
On Jul 17, 2009 1:40pm, Thomas Hartman wrote: > my question to all 3 (so far) respondants is, how does your > > explanation explain that the result is the power set? > > I guess you forgot to reply to the cafe. Well, to me the modified definition I posted looks like the essence of powerset, the

[Haskell-cafe] Re: powerSet = filterM (const [True, False]) ... is this obfuscated haskell?

2009-07-17 Thread Gleb Alexeyev
Thomas Hartman wrote: on haskell reddit today powerSet = filterM (const [True, False]) Does it help if we inline the 'const' function and rewrite [True, False] in monadic notation as (return True `mplus` return False)? powerSet = filterM (\x -> return True `mplus` return False). You can s