I don't quite understand how Data.Array.Diff work.
I tried this:
let arr = listArray (1,3) [1..3] :: DiffArray Int Int
then:
replaceDiffArray arr [(1, 777)]
array (1,3) [(1,1),(2,777),(3,3)]
Why when replacing first element the second one changes?
and also trying to add 4-th element results
2008/7/11 Dmitri O.Kondratiev [EMAIL PROTECTED]:
I don't quite understand how Data.Array.Diff work.
I tried this:
let arr = listArray (1,3) [1..3] :: DiffArray Int Int
then:
replaceDiffArray arr [(1, 777)]
array (1,3) [(1,1),(2,777),(3,3)]
Why when replacing first element the second one
Hello Chaddai,
Friday, July 11, 2008, 4:58:00 PM, you wrote:
There are some libraries that allows you to change the size of your
array, be aware though that this operation is very costly (in every
language).
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ArrayRef
or
How does Data.Sequence
http://www.haskell.org/ghc/docs/latest/html/libraries/containers/Data-Sequence.html
compares with ArrayRef for appending and accessing arrays efficiently ?
On Fri, Jul 11, 2008 at 4:58 PM, Chaddaï Fouché [EMAIL PROTECTED]
wrote:
2008/7/11 Dmitri O.Kondratiev [EMAIL
2008/7/11 Dmitri O.Kondratiev [EMAIL PROTECTED]:
How does Data.Sequence
http://www.haskell.org/ghc/docs/latest/html/libraries/containers/Data-Sequence.html
compares with ArrayRef for appending and accessing arrays efficiently ?
It doesn't since Data.Sequence doesn't use arrays, it uses a
I need extendable array to store and count unique vectors. I have a file
containing vectors presented as strings like:
10, 6, 80, 25, 6, 7
1, 2, 15, 17, 33, 22
21, 34, 56, 78, 91, 2
...
(BTW, what is the best library function to use to convert string of digits
into a list or array?)
There are two
This doesn't require any fancy data structures.
On Fri, Jul 11, 2008 at 08:07:50PM +0400, Dmitri O.Kondratiev wrote:
For example, array of unique vectors:
[[10, 6, 80, 25, 6, 7],
[1, 2, 15, 17, 33, 22],
[21, 34, 56, 78, 91, 2]]
may have a corresponding counts array:
[5,1,3]
Instead store
Dmitri O.Kondratiev wrote:
I need extendable array to store and count unique vectors. I have a file
containing vectors presented as strings like:
10, 6, 80, 25, 6, 7
1, 2, 15, 17, 33, 22
21, 34, 56, 78, 91, 2
...
(BTW, what is the best library function to use to convert string of
digits into a
Thanks for your help, guys! I like simple solutions most of all :)
On Fri, Jul 11, 2008 at 9:44 PM, Reid Barton [EMAIL PROTECTED]
wrote:
This doesn't require any fancy data structures.
Instead store this as a list of pairs [([10,6,80,25,6,7], 5), ...]
and it'll be easy to write a
What is the best way to extend array?
I would use a list instead of array as it is easy to append, but need to
have random access to its elements later.
So in fact I need to start with an integer array of size 1. Next I may need
to add new elements to this array or modify values of the existing
2008/7/10 Dmitri O.Kondratiev [EMAIL PROTECTED]:
allows construct an array of a fixed size. How to add more elements to the
array later?
I can't really answer your question, however I bet that it would
require allocating another, bigger array and copying the old elements
over, at least from
Two questions. How often does the array change, and how big does it
get? It may well be that you just copy it and take the hit, as
that'll be cheaper (even in C, incidentally) than any other solution,
if it's a short array or if the updates happen rarely.
If not, try using Data.Array.Diff and
12 matches
Mail list logo