Is there any way to pre-compute these before processing the tuples? Perhaps computing an array of integers that represent the (ordered) location indexes for the selectors?