
On Apr 29, 2009, at 23:57 , Edward Z. Yang wrote:
Excerpts from Brent Yorgey's message of Wed Apr 29 23:41:03 -0400 2009:
Prelude> sequence [ [1,2,3], [4,5,6] ] [[1,4],[1,5],[1,6],[2,4],[2,5],[2,6],[3,4],[3,5],[3,6]] Prelude> sequence [ [1,2], [3,4,5], [6,7] ]
[[1,3,6],[1,3,7],[1,4,6],[1,4,7],[1,5,6],[1,5,7],[2,3,6],[2,3,7], [2,4,6],[2,4,7] ,[2,5,6],[2,5,7]]
Interesting! According to Hoogle, the sequence function evaluates each monad and then collects the results. I know evaluating a list monad returns a list, but what do they mean by "collect"?
In the list monad, "collect" means "concatenate". -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH