Added a useful function to list-utils along with the broken but more
efficient implementation for sorted indices; might could fix in the
future.