Step 9
This commit is contained in:
parent
3de54bee23
commit
b0cc498b07
|
@ -5,3 +5,9 @@ let interpolate =
|
|||
let maxProportion = (xIntended -. xMin) /. (xMax -. xMin);
|
||||
yMin *. minProportion +. yMax *. maxProportion;
|
||||
};
|
||||
|
||||
/* 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);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/**
|
||||
* @Done
|
||||
* @param {number} xMin
|
||||
* @param {number} xMax
|
||||
* @param {number} yMin
|
||||
|
@ -50,6 +51,7 @@ function range(min, max, n) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Done
|
||||
* @param {number[]} arr
|
||||
* @return {number}
|
||||
*/
|
||||
|
@ -58,6 +60,7 @@ function sum(arr) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Done
|
||||
* @param {number[]} arr
|
||||
* @return {number}
|
||||
*/
|
||||
|
@ -66,6 +69,7 @@ function mean(arr) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Done
|
||||
* @param {number[]} arr
|
||||
* @return {number}
|
||||
*/
|
||||
|
@ -80,6 +84,7 @@ function min(arr) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Done
|
||||
* @param {number[]} arr
|
||||
* @return {number}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user