Front page | perl.golf |
Postings from April 2002
Re: Please explain
Thread Previous
|
Thread Next
From:
Ronald J Kimball
Date:
April 8, 2002 14:11
Subject:
Re: Please explain
Message ID:
20020408171047.E39331@linguist.thayer.dartmouth.edu
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
Thread Previous
|
Thread Next