Method code for $code_lib.statistics_histogram()

[Turn on line numbering]
arg list, bucketsize;
var max, count, out, x;

// takes a sorted list of positive integers and a bucket size and returns a
// histogram
out = [];
count = 0;
max = bucketsize;
for x in (list) {
    if (x > max) {
        if (count)
            out += [[max, count]];
        while (x > max) {
            max += bucketsize;
            refresh();
        }
        count = 1;
    } else {
        ++count;
    }
    refresh();
}
if (x < max)
    out += [[max, count]];
return out;

// $#Edited: 18 Feb 98 11:24 $user_sean
// $#Edited: 18 Feb 98 11:35 $user_sean
// $#Moved 18 Feb 98 11:40 from $user_sean.histo() by $user_sean
// $#Edited: 18 Feb 98 11:46 $user_sean
// $#Edited: 18 Feb 98 11:49 $user_sean
// $#Edited: 20 Jul 98 20:22 $user_bruce
// $#Copied 10 Jun 03 21:59 from $statistics_lib.histogram() by $brandon

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark