static ItIt anagrams_iterator(S s) { Set seen = litciset(s); ret mapI_notNulls(l -> { S x = join(asList(l)); ret add(seen, x) ? x : null; }, allPermutations_iterator(characters(s))); }