Q:

Scala method that takes a function as a parameter and then executes it

I want to write a simple method that takes a function as a parameter and then executes it.
def exec(f: (a:Int, b:Int) => Boolean): Boolean = f(a,b)

I'm not sure what is wrong with the above, but I get the error:
<console>:1: error: ')' expected but ':' found.

A:

def exec(f: (a:Int, b:Int) => Boolean): Boolean = f(a,b)
              ^      ^
              |      |
//   These are supposed to be types, but a: Int and b: Int aren't types,
//   they are identifiers with type ascriptions.

It should look a little more like:
def exec(f: (Int, Int) => Boolean): Boolean = f(a, b)

Now f is a function (Int, Int) => Boolean. But this doesn't compile, because a and b are not defined.
You either need to pass them in, or fix them to a value.
def exec(a: Int, b: Int)(f: (Int, Int) => Boolean): Boolean = f(a, b)

scala> exec(2, 3)(_ > _)
res1: Boolean = false

