[Haskell-cafe] Re: Progress on shootout entries
Bulat Ziganshin
bulatz at HotPOP.com
Wed Jan 4 08:59:46 EST 2006
Hello Josh,
Wednesday, January 04, 2006, 6:00:16 AM, you wrote:
JG> I was able to significantly speed up the code by replacing the flip function with a function that relies entirely on pattern matching (no splitAts or reverses). It looks ugly, though:
JG> mangle list@(1:xs) = list
JG> mangle (2:x2:xs) = x2:2:xs
JG> mangle (3:x2:x3:xs) = x3:x2:3:xs
JG> ... and so on.
such code can be generated by Template Haskell. anyway, one of
purposes of TH creation was to add user-defined optimizations to the
language
--
Best regards,
Bulat mailto:bulatz at HotPOP.com
More information about the Haskell-Cafe
mailing list