RE: 3 `\x y -> x + y` 4 `\x y -> x + y` 5: Wrong version pasted
I pasted the wrong version into the mail. This is the final one: module InfixFunction where infixl 0 $- infixr 0 $+ -- for left-associative functions ($<) :: a -> (a -> b) -> b ($<) x f = f x -- for right-associative functions ($>) :: a -> (a -> b) -> b ($>) x f = f x example1 :: Int example1 = -- 3 `\x y -> x + y` 4 3 $< (\y x -> x + y) 4 example2 :: Int example2 = -- 1 `\x y -> x + y` 2 `\x y -> x` 3 1 $> (\y x -> x + y) 2 $> (\y x -> x + y) 3 Rijk-Jan van Haaften
Hello, Dylan Thurston and I have a different approach to the same problem. See http://haskell.org/pipermail/haskell-cafe/2002-July/003215.html for some short and entertaining code... -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig http://oxford.freeexchange.co.uk/pages/6001.html
participants (2)
-
Ken Shan -
Rijk J. C. van Haaften