diff --git a/packages/squiggle-lang/src/rescript/Utility/E.res b/packages/squiggle-lang/src/rescript/Utility/E.res index 0411bf3c..8e7ec492 100644 --- a/packages/squiggle-lang/src/rescript/Utility/E.res +++ b/packages/squiggle-lang/src/rescript/Utility/E.res @@ -443,6 +443,8 @@ module A = { let mean = a => sum(a) /. (Array.length(a) |> float_of_int) let random = Js.Math.random_int + // Gives an array with all the differences between values + // diff([1,5,3,7]) = [4,-2,4] let diff = (arr: array): array => Belt.Array.zipBy(arr, Belt.Array.sliceToEnd(arr, 1), (left, right) => right -. left)