Alex Chapman <chapman.a...@...> writes:

> 
> Hi anyone who's interested,
> 
> I was frustrated by a word puzzle in a newspaper which in Factor can
> be stated as:
> 
> Find a permutation of the string "mtnymisei" which is a valid English word.

Word puzzles in factor are fun. Another way to state this one is:

Find an English word with the same letters as "mytnymisei"

I'm not really sure about the complexity of set intersection, but this way is
probably faster. Certainly behaves better as the word gets longer.

"mtnymisei" [ natural-sort ] [ length ] bi
"/usr/share/dict/words" utf8 file-lines
[ length = ] with filter
[ >lower natural-sort = ] with find nip

Jason


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to