1.

What is a first-order function?

Answer»

In Scala, FUNCTIONS can be written as LITERALS. They can be assigned to any variable, can be passed to another function as an argument or can be returned from a function as a value. These functions are called first-order functions. For example, in the following code snippet, X => x*x is a first-order function which has been assigned to a value NAMED SQUARE.

val square = x => x*x



Discussion

No Comment Found