From 517a9128e2836fce30c73692a9dc44e0fcea3223 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Tue, 29 Mar 2022 10:55:36 -0400 Subject: [PATCH] E.O.default pattern --- .../src/rescript/utility/Sparklines.res | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/utility/Sparklines.res b/packages/squiggle-lang/src/rescript/utility/Sparklines.res index 35679918..222364b7 100644 --- a/packages/squiggle-lang/src/rescript/utility/Sparklines.res +++ b/packages/squiggle-lang/src/rescript/utility/Sparklines.res @@ -15,16 +15,9 @@ let sparkly = ( // Unlike reference impl, we assume that all numbers are finite, i.e. no NaN. let ticks = [`▁`, `▂`, `▃`, `▄`, `▅`, `▆`, `▇`, `█`] - let minimum = switch options.minimum { - | None => Js.Math.minMany_float(numbers) - | Some(x) => x - } - // 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)) + + let minimum = E.O.default(Js.Math.minMany_float(numbers), options.minimum) + let maximum = E.O.default(Js.Math.maxMany_float(numbers), options.maximum) // Use a high tick if data is constant and max is not equal let ticks = if minimum == maximum && maximum != 0.0 { [ticks[4]]