most elegant functional way to make a histogram

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 21 13:09:21 PDT 2015


I have four arrays of ints, each array representing a kind of 
event associated with that int (they all map to the same space).  
Each array might have the same number multiple times and each 
array will be of different length.

So I would like to plot the int line on x axis and show number of 
times that the number occurs for each array (4 bars for each int).

It's easy to do with loops, but what's best 
functional/algorithmic way, please?  Brain tired today.  I am 
trying to use these opportunities to learn the algorithmic way 
even if loop is more natural.

I could just make four new arrays of ints and use each instead of 
a loop.  Any better way?

Also, for bucketizing, any thoughts on best way to do using 
phobos?  (Cos probably I have too many ints and need to bracket 
them to plot a histogram).

Sorry if this is unclear.


Laeeth.


More information about the Digitalmars-d-learn mailing list