This commit is contained in:
Roman Galochkin 2020-02-21 17:13:04 +03:00
parent b0cc498b07
commit 43746571c9
2 changed files with 5 additions and 0 deletions

View File

@ -6,8 +6,11 @@ let interpolate =
yMin *. minProportion +. yMax *. maxProportion;
};
// @todo: To test!
/* https://bucklescript.github.io/bucklescript/api/Belt.html */
let sum = Belt.Array.reduce(_, 0., (i, j) => i +. j);
let mean = a => sum(a) /. (Array.length(a) |> float_of_int);
let min = Belt.Array.reduce(_, 0., (i, j) => i < j ? i : j);
let max = Belt.Array.reduce(_, 0., (i, j) => i > j ? i : j);
let up = (a, b) => Array.make(b - a, a) |> Array.mapi((i, c) => c + i);
let down = (a, b) => Array.make(a - b, a) |> Array.mapi((i, c) => c - i);

View File

@ -108,6 +108,7 @@ function random(min, max) {
}
/**
* @Done
* @param {number} from
* @param {number} to
* @return {number[]}
@ -119,6 +120,7 @@ function up(from, to) {
}
/**
* @Done
* @param {number} from
* @param {number} to
* @return {number[]}