Re: [Haskell-cafe] Bit string

2006-09-15 Thread Donald Bruce Stewart
tomasz.zielonka: On Fri, Sep 15, 2006 at 11:35:45AM +1000, Thomas Conway wrote: My question for all present is: Have I missed either a problem with using Integer, or have I overlooked a better representation? Consider also (UArray Int Bool). In GHC it has an efficient implementation. A

Re: [Haskell-cafe] Bit string

2006-09-15 Thread Henning Thielemann
On Fri, 15 Sep 2006, Thomas Conway wrote: My question for all present is: Have I missed either a problem with using Integer, or have I overlooked a better representation? With my Modula background, where a machine-oriented SET type is available, I consider using integers as bit sets (as in

[Haskell-cafe] Bit string

2006-09-14 Thread Thomas Conway
Hi all, I'm doing some work with ASN.1, and I'm thinking about how to represent the type BIT STRING. The obvious, and inefficient representation would be type BitString = [Bool] A reasonable sparse representation might be type BitString = [Integer] where the integers represent the

Re: [Haskell-cafe] Bit string

2006-09-14 Thread Lennart Augustsson
It's hard to tell what the best representation is if you don't know what the operations that you are going to perform are. If all you are going to do is I/O of bitstrings, then [Bool] could be great. If you need to do bitwise boolean ops then Integer is a wise choice. -- Lennart

Re: [Haskell-cafe] Bit string

2006-09-14 Thread Thomas Conway
On 9/15/06, Lennart Augustsson [EMAIL PROTECTED] wrote: It's hard to tell what the best representation is if you don't know what the operations that you are going to perform are. If all you are going to do is I/O of bitstrings, then [Bool] could be great. If you need to do bitwise boolean ops

Re: [Haskell-cafe] Bit string

2006-09-14 Thread Tomasz Zielonka
On Fri, Sep 15, 2006 at 11:35:45AM +1000, Thomas Conway wrote: My question for all present is: Have I missed either a problem with using Integer, or have I overlooked a better representation? Consider also (UArray Int Bool). In GHC it has an efficient implementation. Best regards Tomasz