Small surprises while grading programming languages exams
cs.uni.edu
cs.uni.edu
Regarding bound and free variables, I was reverse engineering Python's scoping semantics and discovered this little gem:
def a(x):
def b():
print x
x = 5
b()
a(3)
What do you expect? Prints 3, right? Nope. UnboundLocalError, because 'x' is referenced before it was assigned. It turns out that variable bindings in Python are all lifted to the enclosing 'scope' (usually a function block). So x is not a free variable in the 'print x' line... even though the interpreter claims it's not bound, either.(This behavior is a royal pain to implement in an interpreter. You can't just recursively execute expressions; you have to scan the scope you're about to execute for free variables which are later bound in that scope.)
> "there were far more 0s in the final grid of grades. I even had a couple of 0s on quizzes, where students simply failed to show up."
If this was happening to my class (I am not a teacher!) I would feel it was reflecting badly on me, not the students. Poor grades are one thing but I would feel that zero results (due to increasing numbers of students not showing up) says I need to change my teaching style. A bunch not showing up means they have no faith in your ability to help them fill the gaps in their knowledge to the point they might be able to scrape through with a pass.
If anything, I would think consistently low grades would be worse. This means that people are attending the class, but not "getting it". I think it's trickier with programming; I met many people in my programming courses who just flat out couldn't understand the basic concepts, despite paying attention, taking copious notes, and spending hours studying.
Granted, accumulators can't really improve code that traverses trees. But for code that traverses lists, like zip... accumulators can be useful. Also, the added complexity isn't too bad.
I suspect what the post meant was that while accumulators certainly have their benefits, reflexively using them everywhere is probably a sign that you don't really understand them.