[Haskell-cafe] Nice way to calculate character frequency in a string

Lennart Augustsson lennart at augustsson.net
Tue Oct 25 14:22:22 EDT 2005


Sebastian Sylvan wrote:
> Also, you may use STArrays (I think they come in unboxed as well) for
> stateful code, which may be even faster (unless accumArray does some
> neat trick to make it O(m) where m is the number of index/value
> pairs).

The whole idea with having accumArray as part of the Array signature
is exactly that it should be O(m).  It's an operation you cannot define
in "pure Haskell", i.e., Haskell without any extra types like STArray.

	-- Lennart


More information about the Haskell-Cafe mailing list