Posted on April 21, 2009 at 7:13 pm

Counting bloom filters in python and javascript

Continuing the theme of implementing simple datastructures in python and javascript, here’s a simple counting bloom filter implementation in python and javascript which I’d written for Tagz. I’d almost forgotten about this, until a thread today on compsci.reddit reminded me of it. With this implementation, you can build a bloom filter in python and add/remove/lookup elements. You [...]

Posted on April 11, 2009 at 9:07 am

Tries and Ternary Search Trees in Python and Javascript

There are a couple of places in which Tagz, where I needed efficient prefix matching. The most obvious way to do this is to use a Trie or a Ternary Search Tree. So, I ended up implementing both in Python. I’ve had this stuff lying around in my mercurial repo for Tagz for quite some [...]

Posted on October 4, 2007 at 10:18 am

A trick I learnt from MochiKit

One of the cool things about javascript is prototypal inheritance. The not so cool thing is that I often forget to put a new before a constructor call. A constructor call is nothing but a function call with a ‘new’ prefix. Forget the new prefix and the `this` passed to the function is the global [...]