[Haskell-cafe] Re: Query on list comprehension

Kalman Noel noel.kalman at googlemail.com
Wed Mar 18 09:57:45 EDT 2009


Jon Fairbairn schrieb:
> Melanie_Green <jac_legend_sas at hotmail.com> writes:
>> What are the limitations of list comprehension. [...]
>> a
>> aa
>> aaa
> 
> I'm not clear what you mean by the question. Why do you want
> to use list comprehensions? What if they aren't the best way
> of getting the result you want?
> 
> You can write 
> 
> [a | b <- [replicate n 'a' | n <- [1..]], a <- b ++ "\n"] 
> 
> but does that "replicate" fail to meet your specification?

Since we're »holfing« again:

	fix $ \xs -> [ 'a':xs | xs <- []:xs ]


More information about the Haskell-Cafe mailing list