Add a select-locs function and write select in terms of it.