Scala allows functions with no parameter lists to be invoked without parentheses:
scala> def theAnswer() = 42
theAnswer: ()Int
scala> theAnswer
res5: Int = 42
How would I construct a scala expression that evaluates to the function theAnswer
itself, rather than the result of theAnswer
? Or in other words, how would I modify the expression theAnswer
, so that the result was of type () => Int
, and not type Int
?