static ItIt anagrams_iterator(S s) { Set seen = litciset(s); ret filterIterator(s -> add(seen, s), allPermutations_iterator()); }