Andrew Coppin wrote: > apfelmus wrote: >> Am I missing something or why wouldn't >> >> encode, decode :: String -> String >> encode = encodeRLE . encodeHuffman >> decode = decodeHuffman . decodeRLE >> >> do the job? This is probably what Andrew intends to do in his Java >> version. Note that this not only RLE-encodes the Huffman table but also >> (needlessly) the data stream. In case you only want to RLE the table, a >> simple Word32 field tracking the size of the Huffman table should be >> enough. >> > > It is enough. But given that the whole purpose of compression algorithms > is to squeeze data into the tiniest possible space, I wanted to avoid > having a size field. And mathematically it's perfectly possible to do... > I just can't find a convinient way to do it in Haskell. :-(
Well, those 4 bytes won't kill you. But you can of course stop RLE-decoding as soon as this has read as many bytes as there are in the Huffman table. A systematic way to do this are parser combinators. Regards, apfelmus _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
