3 ms·
> Function application is just substitution. >> No, no, no! This is wrong, and really bad pedagogy. I would avoid the word "substitution" until after evaluatio
by lo_zamoyski 4y ago
> Function application is just substitution.
>> No, no, no! This is wrong, and really bad pedagogy.
I would avoid the word "substitution" until after evaluation order has been covered. Python has applicative order evaluation like most languages. Pedagogically, since evaluation is just a basic concept, it should be explained before the student even gets to functions. Then, when you get to function application, it probably shouldn't take much more to explain that arguments are evaluated first and only then is the function applied on the evaluated values of those arguments. The values are then substituted wherever the parameter appears.
If side effects weren't in the picture, you could postpone discussion of evaluation order a little bit longer until you discuss the consequences evaluation rules have for runtime complexity (using pedagogically appropriate language, of course). So you could get away with allowing inaccurate ideas about substitution for a little while.