Hi all,
A useful feature for zsh would be the ability to convert an array into an array of keys/indexes for that array. For example, converting (a b c d) into (1 2 3 4)
Bash has a syntax for this, with the ${!array[@]} expansion, e.g.
vals=(a b c d)
keys=${!ids[@]}
Could we perhaps add another "Subscript Flag" to zsh, such that it evaluates the array into its indexes? For example, it might be ${(x)array[@]}, such that you could use it like this:
vals=(a b c d)
keys=${(x)ids[@]}
I'd be happy to contribute such a feature but I'm not sure what the contribution process actually is.