In #EY3, the “Higher order function” stage all of the tests involve capturing the environment in a function.
See this test for instance:
fun makeGreeter(greeting) {
fun greet(name) {
print greeting + " " + name;
}
return greet;
}
var sayHello = makeGreeter("Hello");
sayHello("Bob");
The “greet” function uses the “greeting” variable which is not in the global scope. The tests are valid, they just happen to be testing behavior that ought to belong in “Closures” #GG6.
This isn’t a big deal, but it’s just kind of a pain to have to run tests twice for the same behavior. Maybe they should be merged into one stage or the Higher Order Function stage should simply return functions from a function without capturing the parent function’s arguments?
Relevant links (I don’t know if these are useful, this is my first time posting here):
Higher order functions #ey3
Closures #gg6
Like I said above, this is my first post in these forums, please let me know if I should have posted elsewhere or included something different in my post