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

Ketil Malde Ketil.Malde at bccs.uib.no
Thu Oct 27 04:29:45 EDT 2005


Scherrer, Chad wrote:

>Sorry to drag this thread out, but here's one more thing you might
>try...
>  
>
(This is the café, isn't it? :-)

Another option is perhaps to pack both char and count in one Int and use 
some kind of Set.
This should save some space, and possibly time as well (presuming 
bitwise ops are less expensive
than pointer dereferences, which I believe have been a safe assumption 
since the mid-90s), but requires a Set being searchable for ranges.  (Do 
any of the implementations support this, BTW?)

-k


More information about the Haskell-Cafe mailing list