
4 Oct
2011
4 Oct
'11
8:27 a.m.
What would be the idiomatic way to write a function which expands to the following? f n m = do { x1 <- m; guard (f [x1]); x2 <- m; guard (f [x1, x2]); . . . xn <- m; guard (f [x1,x2,...,xn]); } What I'm trying to do is generate a list of lists of length n with some property (checked by f) efficiently.