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

GüŸnther Schmidt gue.schmidt at web.de
Tue Jun 16 21:18:08 EDT 2009


Hi Thomas,

thanks, it seems you found it.

I find it a bit embarrassing that I was unable to figure this out myself.

Günther

Thomas Davie schrieb:
> letterCombos = map (:[]) ['a'..'z'] ++ concatMap (\c -> map ((c++) . 
> (:[])) ['a'..'z']) letterCombos
> 
> Not hugely efficient, if you generate the strings in reverse then you 
> can use (c:) rather than ((c++) . (:[])), but that may not be useful to 
> you.
> 
> Bob
> 
> On 17 Jun 2009, at 02:28, GüŸnther Schmidt wrote:
> 
>> Hi guys,
>>
>> I'd like to generate an infinite list, like
>>
>> ["a", "b", "c" .. "z", "aa", "ab", "ac" .. "az", "ba", "bb", "bc" .. 
>> "bz", "ca" ...]
>>
>> When I had set out to do this I thought, oh yeah no prob, in a heartbeat.
>>
>> Uhm.
>>
>> Help, pls!
>>
>> Günther
>>
>> PS: I know this should be a no-brainer, sry
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list