Trie-ing to optimize text search in F#

Any evil genius knows that if you want to stay on top you need to exercise your mind. Most evil geniuses stay strong by lifting weights with their telekinetic abilities, however I prefer video games. PopCap.com’s Bookworm is one mental exercise I am particularly fond of. Bookworm is simple. You have  7×7 hexagonal grid of…

3

Awesome F# – Decision Trees – Part II

In my previous post I went over the theory behind the ID3 algorithm. Now that we got all that painful math out of the way, let’s write some code! Here is an implementation of the algorithm in F#. (It is also attached to this blog post, download it via the link at the bottom.) open…

3

Sieve of Eratosthenes in F#

If you don’t know what the Sieve of Eratosthenes is, don’t worry because a few days ago neither did I. But in short it is a very simple way to calculate prime numbers. Essentially you loop through all integers and keep a list of numbers which are known to be composite. If you encounter a…

3

F# and Markov Chains, oh my!

Edit 2/8/2010: Updated syntax for latest F# language.   Recently I started playing a collectable card game after some friends got me into it. (Who themselves got back into it after some friends of theirs started playing. Witness the economic potential of viral card games!) As it turns out, I am a pretty poor card…

2