Distinguish tuple elements by index in mem_categorization. Fixes #5362.

r? @pcwalton