[Haskell-cafe] Re: Incremental array updates

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

On Thu, Feb 26, 2009 at 07:27:10PM +0100, Daniel Kraft 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.
> I do not see how I could have done this another way, but I think it  
> should be a fairly common pattern, so if there are ideas, I'd welcome 
> them!

Yes, bucketing problems like this are a common case that the standard
functions cannot handle.  Perhaps the libraries need a canned solution.

More information about the Haskell-Cafe mailing list