Michael Fellinger <m.fellinger / gmail.com> writes:

> Hey travis,
>
> you gave me a good time figuring this one out... after some thought i came up 
> with something that takes roughly 1 second to search 9,6k words for a 
> anagram.
> of course this will go up when you add more words (a task you still can think 
> about)
> all in all, 5 LoC... but i'm sure there are even better ways...
>
> word = "easy".split(//).sort
> anagrams = IO.readlines('/usr/share/dict/british-english').partition {|l|
>   l.strip!
>   (l.size == word.size && l.split(//).sort == word)
> }[0]
> anagrams.each{|x| puts x}

Better use #find_all, no?

-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org