-
-
Save blast-hardcheese/6715cea0a0b30b845081b67ebf6febee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
scala> Foo.buildBar.baz(_, _) | |
res0: (Int, Int) => Int = <function2> | |
scala> res0(1,2) | |
Hello! | |
res1: Int = 3 | |
scala> res0(1,2) | |
Hello! | |
res2: Int = 3 | |
scala> val x = { val z = Foo.buildBar; z.baz(_, _) } | |
Hello! | |
x: (Int, Int) => Int = <function2> | |
scala> x(1,2) | |
res3: Int = 3 | |
scala> x(1,2) | |
res4: Int = 3 | |
scala> Foo.buildBar.baz _ | |
buildBar | |
Hello! | |
res5: (Int, Int) => Int = <function2> | |
scala> res5(1,2) | |
res6: Int = 3 |
This file contains hidden or 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
case class Bar() { | |
println("Hello!") | |
def baz(x: Int, y: Int): Int = x + y | |
} | |
object Foo { | |
def buildBar: Bar = Bar() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment