
2009/4/23 Erik Quaeghebeur
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