Created
March 19, 2015 11:50
-
-
Save shigemk2/02ebbdb72198f9768cb1 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
f1 x y = x - y | |
f2 x y = (-) x y | |
f3 x = (-) x | |
f4 = (-) | |
g1 x = f4 2 x | |
g2 = f4 2 | |
main = do | |
print $ g2 5 |
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
val add: Int => Int => Int = x => y => x + y | |
println(add(1)(2)) | |
def add1(x: Int): Int = add(1)(x) | |
println(add1(1)) | |
def add2 = add(1) | |
println(add2(4)) | |
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
def f1(x: Int, y: Int): Int = x - y | |
def f2(x: Int): Int = f1(3, x) | |
def f3 = f1(3, _:Int) | |
def f4 = f1(_:Int, _:Int) | |
println(f1(3, 2)) | |
println(f2(2)) | |
println(f3(2)) | |
println(f4(3, 2)) | |
def g1(x: Int): Int = f4(2, x) | |
def g2 = f4(2, _:Int) | |
println(g1(5)) | |
println(g2(5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment