Re: [Haskell-cafe] Abstraction leak

2007-07-04 Thread Malcolm Wallace
Andrew Coppin [EMAIL PROTECTED] wrote: While we're on the subject... am I the first person to notice that Haskell doesn't appear to have much support for fiddling with streams of bits? See The Bits Between The Lambdas: Binary Data in a Lazy Functional Language Malcolm Wallace and Colin

Re[2]: [Haskell-cafe] Abstraction leak

2007-07-01 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 30, 2007, 11:48:19 AM, you wrote: me too :) but i never used Haskell for compression itself, only for managing archives. fast compression routines are written in C++ What, you're telling me that fast software cannot be written in Haskell? :-P in my

Re[2]: [Haskell-cafe] Abstraction leak

2007-07-01 Thread Bulat Ziganshin
Hello Andrew, Sunday, July 1, 2007, 1:18:16 PM, you wrote: encoding is simple - make this traversal one time and store bit sequence for each symbol. for decoding, you can find length of longest symbol MaxBits and build table of 2^MaxBits elements which allows to find next symbol by direct

Re: [Haskell-cafe] Abstraction leak

2007-07-01 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Andrew, I see. So build a table of codes and bitmasks and test against that... decodeSymbol = do n - returnNextNBits MaxBits -- this operation doesn't forward input pointer! symbol - table1 ! n bits - table2 ! symbol skipNBits bits return

Re: [Haskell-cafe] Abstraction leak

2007-07-01 Thread Josef Svenningsson
On 6/30/07, Jon Cast [EMAIL PROTECTED] wrote: On Friday 29 June 2007, Jon Cast wrote: Here's my solution (drawn from a library I'll be posting Real Soon Now): snip solution I forgot to point out that this is 75-90% drawn from a library called Fudgets[1], which is probably the most extended

Re: [Haskell-cafe] Abstraction leak

2007-06-30 Thread Bulat Ziganshin
Hello Andrew, Friday, June 29, 2007, 10:39:28 PM, you wrote: I'm writing a whole bunch of data compression programs. me too :) but i never used Haskell for compression itself, only for managing archives. fast compression routines are written in C++ http://www.haskell.org/bz -- Best

Re: [Haskell-cafe] Abstraction leak

2007-06-30 Thread Andrew Coppin
Bulat Ziganshin wrote: Hello Andrew, Friday, June 29, 2007, 10:39:28 PM, you wrote: I'm writing a whole bunch of data compression programs. me too :) but i never used Haskell for compression itself, only for managing archives. fast compression routines are written in C++ What,

Re: [Haskell-cafe] Abstraction leak

2007-06-29 Thread Miles Sabin
Andrew Coppin wrote, If this was Java, you would write all these compression and decompression stages as stream wrappers. So you wrap the raw input stream with an RLE decoder, have the function read the Huffman table, and then take off the RLE decoder and process the rest of the stream.

Re: [Haskell-cafe] Abstraction leak

2007-06-29 Thread David Roundy
On Fri, Jun 29, 2007 at 07:39:28PM +0100, Andrew Coppin wrote: Now I have a problem. It's easy enough to pass the entire data stream through an RLE decoder and feed that to the Huffman table deserialize function, and it will give be back the table. But I now have *no clue* where the table

Re: [Haskell-cafe] Abstraction leak

2007-06-29 Thread Jon Cast
On Friday 29 June 2007, Andrew Coppin wrote: ...and again today I found myself trying to do something that would be very easy in an imperative language, but I cannot think of a single good way of doing it in Haskell. Hopfully somebody can give me some hints. snip long and helpful explanation

Re: [Haskell-cafe] Abstraction leak

2007-06-29 Thread Jon Cast
On Friday 29 June 2007, Jon Cast wrote: Here's my solution (drawn from a library I'll be posting Real Soon Now): snip solution I forgot to point out that this is 75-90% drawn from a library called Fudgets[1], which is probably the most extended practical meditation to date on programming with

Re: [Haskell-cafe] Abstraction leak

2007-06-29 Thread Andrew Coppin
David Roundy wrote: On Fri, Jun 29, 2007 at 07:39:28PM +0100, Andrew Coppin wrote: Now I have a problem. It's easy enough to pass the entire data stream through an RLE decoder and feed that to the Huffman table deserialize function, and it will give be back the table. But I now have *no