I would like to see a sort method for dictionary and arrays,
and a cpuUsage attribute for System.Stats.
// sorts the input array in place. this will be expensive for long arrays.
function bubble_sort(array) {
for (var i = 0; i < array.size(); ++i) {
for (var j = i; j < array.size(); ++j) {
if (array[j] < array) {
var tmp = array;
array= array[j];
array[j] = tmp;
}
}
}
}
[/code]
var f = [ 3, 4.0d, 1l, 2, 7, 9, 0.0, -1, -5, 0, 6 ];
Sys.println(f);
bubble_sort(f);
Sys.println(f);
[3, Obj: 2084472, Obj: 2076328, 2, 7, 9, 0.000000, -1, -5, 0, 6]
[-5, -1, 0.000000, 0, Obj: 2076328, 2, 3, Obj: 2084472, 6, 7, 9]