[plt-scheme] help on how to write a frequency-counting function in a more functional way

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Apr 19 22:42:31 EDT 2009

On Apr 19, 2009, at 9:54 PM, Martin DeMello wrote:

> On Mon, Apr 20, 2009 at 3:31 AM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
>> As soon as you have 100,000 frequencies in an approximate range of  
>> 20,000
>> steps, the functional solutions don't look that good compared to  
>> vectors.
>> With 1,000,000 it's unquestionable. I bet you can repeat this  
>> experiment in
>> C and get similar results. In a sparse world, the results are  
>> indifferent.
> Something I've been wondering about - is sticking to purely functional
> data structures really idiomatic scheme? Specifically in PLT, do they
> buy you any advantage over the imperative, mutable versions?

No, we aren't purists. We are pragmatic. When an issue calls for  
mutation, we have no problem using it. When we can do without, we're  
better off. The key is to know when there's a call. -- Matthias

Posted on the users mailing list.