[Haskell-cafe] A special function
Andrew Coppin
andrewcoppin at btinternet.com
Sat May 19 16:13:39 EDT 2007
I'd like to share something with you. I call it "the evil *******
function from hell":
(Results xss) >>= f = Results $ map concat $ diagonalise $ map (foldr
longZip [] . map (unpack . f)) xss
If you attempt to comprehend how this function works, you WILL in fact
loose your mind! However, it does in fact work completely correctly.
It's just not possible to know why. :-D
newtype Results t = Results [[t]]
unpack (Results xss) = xss
longZip = similar to zip (++)
diagonalise = transform an infinite list of infinite lists into an
infinite list of finite lists.
More information about the Haskell-Cafe
mailing list