[Haskell-cafe] Re: Need some help with an infinite list
Günther Schmidt
gue.schmidt at web.de
Tue Jun 16 21:20:44 EDT 2009
Hi Tom,
thanks for that.
I remembered reading about that in my earliest haskell days, couldn't
find it again and couldn't get it right by myself either.
Günther
Tom Pledger schrieb:
> Günther Schmidt <gue.schmidt <at> web.de> writes:
>
>> Hi guys,
>>
>> I'd like to generate an infinite list, like
>>
>> ["a", "b", "c" .. "z", "aa", "ab", "ac" .. "az", "ba", "bb", "bc" ..
>> "bz", "ca" ...]
>
>
> If you're happy to have a "" before the "a", you can do this as a fairly cute
> one-liner in a similar style to this list of Fibonacci numbers.
>
> fib = 0:1:[m + n | (m, n) <- zip fib (tail fib)]
>
> Regards,
> Tom
More information about the Haskell-Cafe
mailing list