[Haskell-cafe] Need some help with an infinite list

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 17 05:20:18 EDT 2009


On Wed, 17 Jun 2009, Matthew Brecknell wrote:

> Reid Barton wrote:
>> I'm surprised everyone is giving clever recursive solutions rather than
>>
>> concatMap (\n -> replicateM n ['a'..'z']) [1..]
>>
>> Regards,
>> Reid
>
> Well, you've lost efficient sharing with respect to my previous solution
> and one other.
>
> But it's a fair call, so...
>
> tail $ concat $ iterate (map (:) ['a'..'z'] <*>) [[]]

cool


More information about the Haskell-Cafe mailing list