[Haskell-cafe] Re: Incremental array updates

Ross Paterson ross at soi.city.ac.uk
Thu Feb 26 13:54:23 EST 2009

On Thu, Feb 26, 2009 at 09:36:17PM +0300, Bulat Ziganshin wrote:
> Thursday, February 26, 2009, 9:27:10 PM, you wrote:
> > It was about this:  I needed to generate "all possibilities" for some
> > combinations and each of those had a numeric property, say from 1 to 
> > 10000; I then had to count how many of the possibilities were of a given
> > "category".  So I created this array, generated all combinations, and 
> > incremented the matching slot each time.
> it's histogram essentially? accumArray is doing so. internally, it's
> the same loop using STArray, but accumArray provide you pure API for
> such computations

And accumArray can also be used with UArray if laziness is a problem.

More information about the Haskell-Cafe mailing list