[Haskell-cafe] powerSet = filterM (const [True,
False]) ... is this obfuscated haskell?
Sittampalam, Ganesh
ganesh.sittampalam at credit-suisse.com
Tue Jul 28 09:58:29 EDT 2009
Sebastian Fischer wrote:
> On Jul 28, 2009, at 11:06 AM, Sittampalam, Ganesh wrote:
>
>>> perms = sortByM (const [True,False])
>>
>> and moreover the results will depend on the sorting algorithm chosen.
>
> Is it only that different sorting algorithms enumerate all
> permutations in different orders or is there a sorting algorithm,
> such that the above definition does not enumerate all permutations?
>
[..]
> Hence, perm as defined above can yield a list that contains all
> permutations of the input (at least once) regardless of the sorting
> algorithm.
>
> Where is the hitch?
The "at least once" bit - unless your non-determinism is based on set
rather than bag semantics, it's wrong to duplicate results.
Ganesh
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
More information about the Haskell-Cafe
mailing list