some fixes in terms of map

Mainly, make a intermediate function to get the keys we want. 
Unfortunately, this doesn't quite preserve the semantics -- there's another version of loc() with only two arguments. I probably need to refactor this, but currently any rule pattern matching on SymLoc (e.g., below) also must consider the loc(_, _) version. I'd suggest you maintain my "blah" vs. "#blah" distinction and only do pattern matching on the "#blah" productions.