Functions Inside Functions
Here we have some functions defined below. Run through and figure out what the two calls at the bottom output and then draw the environment diagram.
def f(g, f): return g(f) def foo(g, h): return h * g(h) def h(i): return 5 f(h, foo) #1 f(h, foo(h, 3)) #2
The important thing to note here is the order of evaluation. Remember that you don’t pay attention to the body of a function until you actually call the function AND that you need to evaluate all of your operands before you can apply your operator.
I don't claim to be perfect so if you find an error on this page, please send me an email preferably with a link to this page so that I know what I need to fix!