[erlang-questions] Accumulators..

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Tue Oct 26 04:34:56 CEST 2010


On Tue, Oct 26, 2010 at 8:54 AM, rgowka1 <rgowka1@REDACTED> wrote:

> My question is - Is there a way to generalize and extend the use of
> accumulators? Joe divides a list of numbers into Evens and Odds by
> using two empty lists are accumulators. Is there a way to extend this
> approach to N buckets. For example, traverse a big list just one  -
> lists:seq(1,math:pow(2,32)) and group them into 100 buckets like all
> the numbers divisible by 2 in bucket 1, all the numbers divisible by 3
> in bucket 2, all the numbers divisible by 5 in bucket 3... etc.
>
>
To process 100 buckets, you'll use another predicate, and it means
to treat buckets accumulation another problem which uses accumulators
to save computing efficiency.

Best Regards.

--- Y-H. Y.


More information about the erlang-questions mailing list