| 1. |
Explain ‘scala Higher Order’ Functions? |
|
Answer» Scala allows the definition of higher order functions. These are functions that take other functions as parameters, or whose result is a FUNCTION. In the following example, apply () function takes another function ‘f’ and a value ‘v’ and applies function to v. Example: object Test { When the above code is compiled and EXECUTED, it produces following result. C:/>scalac Test.scala Scala allows the definition of higher order functions. These are functions that take other functions as parameters, or whose result is a function. In the following example, apply () function takes another function ‘f’ and a value ‘v’ and applies function to v. Example: object Test { When the above code is compiled and executed, it produces following result. C:/>scalac Test.scala |
|