On Mon, Apr 08, 2002 at 02:07:03PM -0700, Mark Schoonover wrote:
>
> --=={First, sort puts its arguments into list context.
>
> Cool so far...
>
> --=={This is then sorted by the
> --=={sort, and two words are anagrams if and only if they agree
> --=={about their sorted letters.
>
> Huh?? This is the part that tripped me up. I don't understand how it knows
> if the new words are valid words.
There are no "new words". The idea is to create a canonical form for each
word so you can easily tell if two words are anagrams of each other.
For example, this is hard:
are_anagrams('post', 'stop')
but this is easy:
are_anagrams('opst', 'opst')
It doesn't matter that the sorted letters don't form an actual word.
Ronald