To provide some common ground for the readers with different levels of Scala knowledge, let's recap how a function can be defined. We'll start with the basic approaches such as defining a method and placing it in different scopes to create a local function. Then we'll look at more interesting aspects, for example closing over scope, partial application, different ways to specify function literals, and, finally, currying.
Ways to define a function
Function as a method
Most Scala developers came to it from Java. Because of this, probably the most common way is to define a method inside of a class, trait, or an object, like in the following familiar example:
class MethodDefinition {
def eq(arg1: String, arg2:...