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

Casey Hawthorne caseyh at istar.ca
Wed Jun 17 01:24:56 EDT 2009


On Wed, 17 Jun 2009 00:45:56 -0400, you wrote:

>And here's a version along similar lines that avoids (++) for greater 
>sharing and efficiency:
>
>   let sss = [""] : [ [ c:s | c <- ['a'..'z'], s <- ss ] | ss <- sss ] 
>in concat (tail sss)

Sheer genius!

I just inverted it since I like to see the main idea first.

letterCombos = concat (tail sss)
	where
		sss = [""] : [ [ c:s | c <- ['a'..'z'], s <- ss ] | ss <- sss ] 

--
Regards,
Casey


More information about the Haskell-Cafe mailing list