WIP: generalize categorical to N-dimensions

I will add a test to make sure but I don't think so. A 1d array or list with one element is not a scalar.