[Haskell-cafe] Histogram creation

Alexey Khudyakov alexey.skladnoy at gmail.com
Mon Nov 10 08:02:56 EST 2008


I'm tryig to write efficient code for creating histograms. I have following
requirements for it:

1. O(1) element insertion
2. No reallocations. Thus in place updates are needed.

accumArray won't go because I need to fill a lot of histograms (hundrends) from
vely long list of data (possibly millions of elements) and it will traverse
input data for each histogram.

It seems that I need to use mutable array and/or ST monad or something else.
Sadly both of them are tricky and difficult to understand. So good examples or
any other ideas greatly appreciated.

  Alexey Khudyakov

More information about the Haskell-Cafe mailing list