Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Last active August 29, 2015 14:07
Show Gist options
  • Save wrobstory/28ce5fecb3a11dcea564 to your computer and use it in GitHub Desktop.
Save wrobstory/28ce5fecb3a11dcea564 to your computer and use it in GitHub Desktop.
Higher Order Wat
def add(x: Int, y: Int = 1): Int = x + y
def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer(z)
// Exiting paste mode, now interpreting.
<console>:9: error: not enough arguments for method apply: (v1: Int, v2: Int)Int in trait Function2.
Unspecified value parameter v2.
def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer(z)
scala> def add(x: Int = 1, y: Int = 2): Int = x + y
add: (x: Int, y: Int)Int
scala> add()
res0: Int = 3
scala> def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer()
<console>:7: error: not enough arguments for method apply: (v1: Int, v2: Int)Int in trait Function2.
Unspecified value parameters v1, v2.
def transform(z: Int, transformer: (Int, Int) => Int): Int = transformer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment