[Haskell-cafe] Query on list comprehension

Adrian Neumann aneumann at inf.fu-berlin.de
Wed Mar 18 03:07:35 EDT 2009


Use a nested list comprehension, for example

Prelude> [['a'| i <- [0..n]]++"\n"|n <- [1..3]]
["aa\n","aaa\n","aaaa\n"]



Am 18.03.2009 um 07:47 schrieb Melanie_Green:

>
> What are the limitations of list comprehension. I want to use
> listcomprehension to output the pattern below. So a mixture of a's and
> newline characters. The part im stuck at is creating arguments in the
> listcomprehension to stop at some point then execute next loop. Is  
> it even
> possible to create the pattern below purely from list  
> comprehension.Thankyou
> in advance.
>
> a
> aa
> aaa
> -- 
> View this message in context: http://www.nabble.com/Query-on-list- 
> comprehension-tp22573574p22573574.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: Signierter Teil der Nachricht
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090318/8d7cc41a/PGP.bin


More information about the Haskell-Cafe mailing list