[Haskell-cafe] Re: Query on list comprehension
Yitzchak Gale
gale at sefer.org
Wed Mar 18 06:38:36 EDT 2009
Melanie_Green writes:
>> I want to use listcomprehension to output the pattern below...
Jón Fairbairn wrote:
> Why do you want to use list comprehensions?
> What if they aren't the best way of getting the
> result you want?
unlines . tail . inits . repeat $ 'a'
> concat [replicate n 'a' ++ "\n" | n <- [1..]]
Or:
unlines [replicate n 'a' | n <- [1..]]
-Yitz
More information about the Haskell-Cafe
mailing list