simplify index_of
move implementation details from sequence to is_distinct