Break up indices() into type-specialized functions

Let Julia do the type checking for us, which is both cleaner and
more Julia, though performance remains the same. Stop returning
ranges when passed a scalar, since we want to preserve their
special behavior (is had no effect anyway).

Support negative integer for vectors too. Convert reals into integers
if possible, so that we can use setdiff() to also support negative
values in that case.