Apply fn to lists of indexes generated from symbol counts. The counting isdone so that the first symbol varies most quickly unless the optional directionparameter is set to :right.