[Haskell-beginners] List Function

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Apr 30 08:29:25 EDT 2009


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 at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20090430/4c69132c/PGP.bin


More information about the Beginners mailing list