xsl-list
[Top] [All Lists]

[xsl] Fun w/ Anagrams and FXSL: Anagram Baby Names! :D (And A Mystery To Help Solve)

2008-01-08 16:20:10
Just because I have way too much to do and an uncanny *in*ability to stay focused on *anything* important, I decided to excercise my brain a bit and follow suit to Dare Obasanjo's C#/LINQ response[1] to Brad Fitzpatrick's Python and Perl-based baby name anagram code challenge[2]**. Of course what better way to excercise ones brain than to find someone who's smarter than you, take their prewritten code[3] that they slaved over for who knows how long to perfect, customize it, and call it your own? :D

That's exactly how I feel too ;-), and as such, here's my variation of Dimitre's anagram code base customized to output all potential anagram combinations of baby names (both girls and boys).

The code: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/anagaram-baby-names.xsl The female names: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/dist.female.first The males names: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/dist.male.first The result: http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/result

NOTE: To run this code you will either need to either check out the trunk of of the XSLT Google Code SVN repository[4], or if you already have FXSL on your machine, check out[5] and change the values of the xsl:import elements to point at the location of the FXSL libraries on your machine. Also, if you're on Windows and you check out the trunk of the repository, you may need to adjust the import values to ../../../Functions/fxsl-xslt2/f/<name_of_function_library>.xsl as I've symlink'd the "f" directory and I'm not sure how SVN handles symlinks on Windows during the checkout process. Anyone know if it resolves symlinks and copys the linked directory in place of the symlink?

Now comes the fun stuff,

If you scroll to the bottom of the result you'll see a good example of something that currently has me scratching my head,

Key: ORRY Names: RORY  RORY
Key: ORTY Names: TROY  TORY  TROY  TORY
Key: ORY Names: ROY  ROY

Question: Why are there some entries in which see the same visible name as being different?

Is it (potentially) because the given name exists in both lists and I need to for-each-group the entries before generating the dictionary (or after for that matter).

Something different?

Ideas?

Thanks in advance for helping me solve my current mystery!

[1] http://www.25hoursaday.com/weblog/2008/01/08/FindingNamesThatAreAnagramsOfEachOtherInC30.aspx
[2] http://brad.livejournal.com/2354680.html
[3] http://dnovatchev.spaces.live.com/blog/cns!44B0A32C2CCF7488!357.entry
[4] http://xslt.googlecode.com/svn/trunk/
[5] http://xslt.googlecode.com/svn/trunk/Modules/Anagram/BabyNames/
** Okay, so it wasn't really a code challenge per se, but if you write a blog entry with any given coding solution to any given problem, it might as well be a challenge 'cuz every language loving zealot on the planet is going to see it as just that. :D

--
/M:D

M. David Peterson
Co-Founder & Chief Architect, 3rd&Urban, LLC
Email: m(_dot_)david(_at_)3rdandUrban(_dot_)com | 
m(_dot_)david(_at_)amp(_dot_)fm
Mobile: (206) 418-9027
http://3rdandUrban.com | http://amp.fm | http://www.oreillynet.com/pub/au/2354

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>