Closed cbarrick closed 6 years ago
Tested and fixed
Rebased on master
A closure is just a function that uses variables outside of it's definition. In this case, the lambda uses the variables base
, kind
, and x
, but only x
is local to it's definition. The other two are defined outside the lambda, making it a closure.
Typically, we use the word "closure" for any function being passed around like any other object (e.g. being returned) even when the function is not a true closure.
In our case, it's a closure by both definitions.
This is related to the concept of decorators in Python.
I've added three functions to get us started.
I have not tested these yet, but I thought to submit the PR anyway. I'll test them after dinner.You can pull this code into your local git repo to use and test.
First, make sure you have my remote if you don't already:
Next, download my preprocess branch and switch to it:
Now you can use and test the code.
If you want to create new work based on this, make a new branch:
I'll do my own testing later tonight. Hopefully this can merge as-is. If you need help with git or GitHub, HMU on slack!