Last active
September 8, 2016 17:27
-
-
Save Titinx/4c21570a64de9959c30b1dcbda1fa6af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- *** Expression : curry | |
-- *** Of type : ((a,b) -> c) -> a -> b -> c | |
-- definicion where | |
myCurry f = g | |
where g x = h | |
where h y = f (x,y) | |
-- definicion "λ" - funcion anonima (Lambda): | |
myCurry' f = \x -> ( \y -> f (x,y) ) | |
-- definicion currificada: | |
-- ((mycurry'' f) x) y = f (x,y) | |
-- como la aplicacion asocia a izquierda, es igual a: | |
myCurry'' f x y = f (x,y) | |
-- Probar con myCurry fst 3 2 | |
-- *** Expression : uncurry | |
-- *** Of type : (a -> b -> c) -> (a,b) -> c | |
myUncurry f = g | |
where g (a,b) = f a b | |
myUncurry' f = \(a,b) -> (f a b) | |
myUncurry'' f (a,b) = f a b | |
-- Probar con myUncurry max (3,2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment