"Constant time" symbol table

Actually, it's O(definitions in topmost scope) upon leaving a scope,
since each reference in the index has to be set to its previous
definition, so I'm not sure if this is to ever outperform the old
version on realistic inputs, but it should be better at handling deep nesting.
Shouldn't you use `index` instead of `lookup` in here?