Skip to content

Commit 9f17df4

Browse files
committed
slightly better explanation of what a Higher Order Function is
1 parent ce819fe commit 9f17df4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/scala/stdlib/HigherOrderFunctions.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ object HigherOrderFunctions
8686
result2 should be(res1)
8787
}
8888

89-
/** We can take that closure and throw it into a method and it will still hold the environment:
89+
/** And then we get to Higher Order Functions:
90+
* Higher Order Functions are functions that take functions as arguments and/or return functions.
91+
*
92+
* We can take that closure and throw it into a Higher Order Function and it will still hold the environment:
9093
*/
9194
def holdEnvironmentHigherOrderFunctions(res0: Int, res1: Int) {
9295
def summation(x: Int, y: Int Int) = y(x)
@@ -102,7 +105,7 @@ object HigherOrderFunctions
102105
result2 should be(res1)
103106
}
104107

105-
/** Function returning another function:
108+
/** Higher Order Function returning another function:
106109
*/
107110
def returningFunctionHigherOrderFunctions(res0: Boolean, res1: Int, res2: Int) {
108111
def addWithoutSyntaxSugar(x: Int): Function1[Int, Int] = {

0 commit comments

Comments
 (0)