[Haskell-beginners] generating the set of all finite-valued [...]

Erik Quaeghebeur equaeghe at nospammail.net
Mon Apr 27 14:39:26 EDT 2009


> 2009/4/23 Erik Quaeghebeur <equaeghe at nospammail.net>
>
>> I'd like to lazily generate the set of all {-1,0,1}-valued functions on
>> {'a','b','c'}? How should I best approach this. I was thinking about
>> generalizing the power set definition
>>
>> powerset :: [a] -> [[a]]
>> powerset = filterM (const [True, False])
>>
>> but clearly don't know enough about filterM and the like to do it this way.
>>
>> Erik

On Mon, 27 Apr 2009, Haroldo Stenger wrote:
>
> i got curious about this one. Can you elaborate ?

Well, elaborate about my ultimate goal, or about the powerset definition? 
The latter I can tell little about, I found it on-line and recognized it 
as a starting point. The former: generalizing 
http://users.ugent.be/~equaeghe/constraints.php to previsions from 
probabilities; C++ is a little too heavy, so I thought I'd try out 
Haskell.

Erik



More information about the Beginners mailing list