[Haskell-cafe] Copying Arrays
aneumann at inf.fu-berlin.de
Thu May 29 12:58:39 EDT 2008
Isn't fast IO what ByteStrings where invented for?
Tom Harper schrieb:
> I'm trying to implement some file I/O where I can read in a file to an
> array, but do so without having to know how much space I will need.
> (Before you suggest it, lists are too slow/space consuming.) I was
> thinking that one possible solution is to use a strategy used in
> dynamic arrays, where everytime you run out of space you double the
> capacity of the array. Trouble is, most arrays in Haskell would
> require you to traverse the entire array and copy each individual
> cell, which would make it worthless.
> Are there any low-level array types (MutableByteArray#, for example)
> that support a memcpy-like function where I could copy the entire
> array into the new one instead of copying it one value at a time? Is
> there another solution that I'm missing?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080529/5a31a4c8/signature.bin
More information about the Haskell-Cafe