Anagram calculus