PDA

View Full Version : Whatcha doin'?


jemfinch
06-28-2002, 12:08 AM
Ok, so I'm just curious what you folks are doing (and, perhaps, if any of the SML-ites want to help me with what I'm doing :))

I've been writing a unit-testing framework for SML, based loosely on JUnit, Fort (http://www.sf.net/projects/fort/) for O'Caml, and QuickCheck (http://www.math.chalmers.se/~rjmh/QuickCheck/) for Haskell. It's going well -- I'm got some details to fill out, but the signatures (http://arstechnica.infopop.net/OpenTopic/page?a=tpc&s=50009562&f=6330927813&m=3860905394) are mostly filled out (that is, the design step is mostly done :))

Aside from that, I've been looking into SmallTalk a bit lately, not to program in myself, really, but to write an interpreter for in SML. It seems rather ideal for extending an IRC bot, and decent for configuration -- most importantly, however, it seems rather easy to implement. This is something I could definitely use some help on, if anyone's interested.

Later on I'll start whipping up an asynchronous networking framework (I don't really want to use CML for my networking) and subsequently an IRC bot in SML. Then I'll get to integrate this all together in one big program that hopefully will r0x0r the IRC bot world (or at least the channel I write IRC bots for :))

So what are you guys doing? Anyone have something I can help with, or want to help me with what I'm doing?

Jeremy

GnuVince
06-28-2002, 12:22 AM
I'm currently writing an anagram generator in O'Caml. I have already written a version, but it is WAY WAY WAY WAY WAY far from being efficient :) Right now I'm using lists: if user inputs a n letter word, I have one big list containing n! char lists of n elements. As you can see, this can take a LOT of RAM and it's really slow to generate. For a 9 letter words, my Athlon 1GHz with 384 megs of ram took 3 minutes 40 seconds to finish the task and it ate all my ram and half my swap (512 MB). So right now, I'm trying to find a more efficient way to print all the possible permutations (back to the paper & pen stage). After that, I will probably try to check the possibilites with a dictionnary so I can have entries with at least on real word.

jemfinch
06-28-2002, 12:38 AM
Can't you just print the anagrams as you generate them? Or, even better, only print them if they are in the dictionary.

Jeremy

GnuVince
06-28-2002, 07:49 AM
That's what I want to do right now. I'm trying to think of a way where I could keep a state of the last permutation (maybe in a record).

Strike
06-28-2002, 09:47 AM
You could just treat each letter in your n-length input as sort of an "enumeration" of sorts, and then do essentially just base-n counting.

Example:
input string - "GnuVince"
We'll do base 8 counting because "GnuVince" is 8 chars long. The enumeration is simply:
0 = G
1 = n
...
7 = e

Then, you simply do octal counting from 01234567 to 76543210, ignoring any number with duplicate digits in it (granted, this takes time to generate, but you don't have to generate strings for them). Once you do have a number with all unique digits, generate the string using the enumeration and print it out/store it.

Alternately, you could do some digit shifting using some pre-determined algorithm and still use the enumeration idea. For example, you could go from:
01234567 -> 01234576 -> 01234756 -> 01237456 -> 01273456 -> 01723456 -> 07123456 -> 70123456 -> 01234657 -> 01236457 -> ...
Now, how to describe that algorithmically, I can't come up with right now, but it can probably be done.

jemfinch
06-28-2002, 10:35 AM
So where's our favorite PrBacterio?

Jeremy

jemfinch
06-30-2002, 06:34 PM
I posted the "real" solution to the anagram problem in the thread Strike started in Programming Blarg.

Jeremy

Strike
07-04-2002, 03:03 AM
Originally posted by jemfinch
So where's our favorite PrBacterio?

Jeremy
You know, a Chemistry professor of mine used to say, "Remember ... wherever you go, there you are." He was also a baseball coach. :)

(actually, he really was, and he was also a really good chem professor too :) just had a predilection for stupid jokes)