On Mon, 19 Mar 2001, Dave Thomas wrote:

> I want to implement a compression scheme for some text, and I want to
> implement it in pure Ruby.
> I hacked up a simple LZW compressor (it was about 6 lines of Ruby) and 
> it works fine, but I believe that the Unisys patent prevents the use
> of this in commercial applications. I tried basic RLE and Huffman, but 
> the compression wasn't too good.
> So could anyone recommend a scheme that's free for use, and which can
> be realistically decompressed in a handful of lines of Ruby?

Wait 2 more years and the patent will expire. Unisys/IBM never
successfully enforced it on GIFs anyway.

Or pick up GZIP's source. This is a fairly standard package that has
literally no bugs and has barely changed since 1993. The source code is
made of GPL'd parts and public domain parts, in C (with optional 386/68k
assembly language code).

The whole source code is 250k, from which you could remove the commandline
interface, the alternate decompressors, the comments, the type
declarations, the ifdefs, the extraneous linefeeds... and then translate
to Ruby, at which point it would be about 40k for both parts together. (?)

Then if you coded LZW in 6 lines, you should be able to shrink this one to
a few pages (heh) 

matju