Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 2.03 KB

IDEAS

File metadata and controls

55 lines (39 loc) · 2.03 KB

-*- org -*-

A grab bag of ideas that are applicable to all the implementations, but probably appear only in some.

Don’t list all anagrams – use “delay”

Rather than listing all the anagrams, instead just list the words that can be made from the bag, and next to each word, provide a thunk which will generate the remaining anagrams. This should save a lot of time if you’re just looking for funny anagrams – you’ll get a list of perhaps 100 words that can be made from the bag; you’ll choose one, the thunk will run, and you start over.

Use a simple string of sorted letters as the bag.

This isn’t necessarily better than any other method for all implementations, but it seems the best for Perl 5, since it can be used as a hash key (convenient when reading the dictionary). And anyway, subtracting two such things ought to be fast, assuming that substr is fast.

And yet I tried this first when writing the C++ version. It worked OK, but I then tried using bignums … and they were twice as fast. Hmm.

Ensure each implementation uses the same dictionary

Many (especially those I’ve touched recently) use the dictionary in this directory, but some (C++ in particular) still look for /usr/share/dict/words, which of course won’t work on Windows.

Languages to do

perl6

tcl !

Apply the pruning optimization that I did in r2173 to other implementations.

Apply the sorting optimization that I did in 8f9c80574c55933440e972d7c6af21859aa7c06b to other implementations.

Factor out common Scheme code.

This is probably much harder than it should be, because I really mean “write one program which will work in all the scheme implementations”. Writing portable Scheme is hard (and, as I repeatedly proclaim on IRC, not worth the effort). Let’s go shopping.

Maybe just combine the DrScheme and MzScheme versions

They’re practically the same, except the former draws stuff in a window, whereas the latter just returns a list of stuff.

“CoreLogic”. Some kinda weird varient of Clojure.

Suggested by Kevin-from-Seajure.