squiggle/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res

60 lines
1.7 KiB
Plaintext
Raw Normal View History

open FunctionRegistry_Core
open FunctionRegistry_Helpers
2022-05-21 15:41:12 +00:00
let twoArgs = E.Tuple2.toFnCall
module NormalFn = {
let fnName = "normal"
let toFn = Function.make(
~name="Normal",
~definitions=[
2022-05-20 21:36:40 +00:00
TwoArgDist.mkRegular(fnName, twoArgs(SymbolicDist.Normal.make)),
TwoArgDist.mkDef90th(fnName, r => twoArgs(SymbolicDist.Normal.from90PercentCI, r)->Ok),
TwoArgDist.mkDefMeanStdev(fnName, twoArgs(SymbolicDist.Normal.make)),
],
)
}
module LognormalFn = {
let fnName = "lognormal"
let toFn = Function.make(
~name="Lognormal",
~definitions=[
2022-05-20 21:36:40 +00:00
TwoArgDist.mkRegular(fnName, twoArgs(SymbolicDist.Lognormal.make)),
TwoArgDist.mkDef90th(fnName, r => twoArgs(SymbolicDist.Lognormal.from90PercentCI, r)->Ok),
TwoArgDist.mkDefMeanStdev(fnName, twoArgs(SymbolicDist.Lognormal.fromMeanAndStdev)),
],
)
}
2022-05-20 21:36:40 +00:00
let more = [
Function.make(
~name="Uniform",
~definitions=[TwoArgDist.mkRegular("uniform", twoArgs(SymbolicDist.Uniform.make))],
),
Function.make(
~name="Beta",
~definitions=[TwoArgDist.mkRegular("beta", twoArgs(SymbolicDist.Beta.make))],
),
Function.make(
~name="Cauchy",
~definitions=[TwoArgDist.mkRegular("cauchy", twoArgs(SymbolicDist.Cauchy.make))],
),
Function.make(
~name="Gamma",
~definitions=[TwoArgDist.mkRegular("gamma", twoArgs(SymbolicDist.Gamma.make))],
),
Function.make(
~name="Logistic",
~definitions=[TwoArgDist.mkRegular("logistic", twoArgs(SymbolicDist.Logistic.make))],
),
Function.make(
~name="To",
2022-05-21 02:53:53 +00:00
~definitions=[TwoArgDist.mkRegular("to", twoArgs(SymbolicDist.From90thPercentile.make))],
2022-05-21 02:54:15 +00:00
),
2022-05-20 21:36:40 +00:00
]
2022-05-21 15:41:12 +00:00
let allFunctions = E.A.append([NormalFn.toFn, LognormalFn.toFn], more)