E.O.default pattern

This commit is contained in:
Quinn Dougherty 2022-03-29 10:55:36 -04:00
parent 49c091043a
commit 517a9128e2

View File

@ -15,16 +15,9 @@ let sparkly = (
// Unlike reference impl, we assume that all numbers are finite, i.e. no NaN. // Unlike reference impl, we assume that all numbers are finite, i.e. no NaN.
let ticks = [`▁`, `▂`, `▃`, `▄`, `▅`, `▆`, `▇`, `█`] let ticks = [`▁`, `▂`, `▃`, `▄`, `▅`, `▆`, `▇`, `█`]
let minimum = switch options.minimum {
| None => Js.Math.minMany_float(numbers) let minimum = E.O.default(Js.Math.minMany_float(numbers), options.minimum)
| Some(x) => x let maximum = E.O.default(Js.Math.maxMany_float(numbers), options.maximum)
}
// let minimum = E.O.default(Js.Math.minMany_float(numbers))
let maximum = switch options.maximum {
| None => Js.Math.maxMany_float(numbers)
| Some(x) => x
}
// let maximum = E.O.default(Js.Math.maxMany_float(numbers))
// Use a high tick if data is constant and max is not equal // Use a high tick if data is constant and max is not equal
let ticks = if minimum == maximum && maximum != 0.0 { let ticks = if minimum == maximum && maximum != 0.0 {
[ticks[4]] [ticks[4]]