Shadow assoc

This merges paultag's branch that fixes apply with shadowed operators and adds tests, as well as shadowing assoc.

This #724 and #647.