[Haskell-cafe] Code Golf

Matt Morrow moonpatio at gmail.com
Wed Apr 15 23:08:07 EDT 2009


And i forgot to include the defs of (co)prod:

coprod (<>) i1 i2 = (\a b -> i1 a <> i2 b)
prod   (><) p1 p2 = (\a   -> p1 a >< p2 a)

diag = foldr (curry (prod mappend
                            fst
                            snd
        . uncurry (coprod mappend
                            (splitAt 2)
                            (splitAt 1)))) []

Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090415/d03743a9/attachment.htm


More information about the Haskell-Cafe mailing list