merge Reducer
This commit is contained in:
parent
7b2c16d90f
commit
95d3bf6eaa
|
@ -80,6 +80,7 @@ describe("eval on distribution functions", () => {
|
|||
testEval("truncateLeft(normal(5,2), 3)", "Ok(Point Set Distribution)")
|
||||
testEval("truncateRight(normal(5,2), 3)", "Ok(Point Set Distribution)")
|
||||
testEval("truncate(normal(5,2), 3, 8)", "Ok(Point Set Distribution)")
|
||||
testEval("isNormalized(truncate(normal(5,2), 3, 8))", "Ok(true)")
|
||||
})
|
||||
|
||||
describe("exp", () => {
|
||||
|
|
|
@ -2,4 +2,5 @@ module Module = Reducer_Category_Module
|
|||
|
||||
let internalStdLib = Module.emptyModule->SquiggleLibrary_Math.makeBindings
|
||||
|
||||
@genType
|
||||
let externalStdLib = internalStdLib->Module.toTypeScriptBindings
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
module Bindings = Reducer_Category_Module
|
||||
module Module = Reducer_Category_Module
|
||||
|
||||
let m =
|
||||
Module.emptyModule->Module.defineNumber("pi", Js.Math._PI)->Module.defineNumber("e", Js.Math._E)
|
||||
let availableNumbers: array<(string, float)> = [
|
||||
("pi", Js.Math._PI),
|
||||
("e", Js.Math._E),
|
||||
("ln2", Js.Math._LN2),
|
||||
("ln10", Js.Math._LN10),
|
||||
("log2e", Js.Math._LOG2E),
|
||||
("log10e", Js.Math._LOG10E),
|
||||
("sqrt2", Js.Math._SQRT2),
|
||||
("sqrt1_2", Js.Math._SQRT1_2),
|
||||
("phi", 1.618033988749895),
|
||||
("tau", 6.283185307179586),
|
||||
]
|
||||
|
||||
let makeBindings = (previousBindings: Module.t): Module.t =>
|
||||
previousBindings->Bindings.defineModule("Math", m)
|
||||
let mathBindings: Bindings.t =
|
||||
availableNumbers
|
||||
->E.A2.fmap(((name, v)) => (name, ReducerInterface_InternalExpressionValue.IevNumber(v)))
|
||||
->Bindings.fromArray
|
||||
|
||||
let makeBindings = (previousBindings: Bindings.t): Bindings.t =>
|
||||
previousBindings->Bindings.defineModule("Math", mathBindings)
|
||||
|
|
Loading…
Reference in New Issue
Block a user