tweak: Move new functions to the "Danger" namespace
This commit is contained in:
parent
19ddd4eb3f
commit
3106a10b90
|
@ -1,6 +1,7 @@
|
||||||
let fnList = Belt.Array.concatMany([
|
let fnList = Belt.Array.concatMany([
|
||||||
FR_Dict.library,
|
FR_Dict.library,
|
||||||
FR_Dist.library,
|
FR_Dist.library,
|
||||||
|
FR_Danger.library,
|
||||||
FR_Fn.library,
|
FR_Fn.library,
|
||||||
FR_Sampleset.library,
|
FR_Sampleset.library,
|
||||||
FR_List.library,
|
FR_List.library,
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
open FunctionRegistry_Core
|
||||||
|
open FunctionRegistry_Helpers
|
||||||
|
|
||||||
|
let nameSpace = "Danger"
|
||||||
|
let requiresNamespace = true
|
||||||
|
|
||||||
|
module TwoNumbersToNumber = {
|
||||||
|
let make = (name, fn) =>
|
||||||
|
FnDefinition.make(
|
||||||
|
~name,
|
||||||
|
~inputs=[FRTypeNumber, FRTypeNumber],
|
||||||
|
~run=(_, inputs, _, _) => {
|
||||||
|
inputs->Prepare.ToValueTuple.twoNumbers->E.R2.fmap(fn)->E.R2.fmap(Wrappers.evNumber)
|
||||||
|
},
|
||||||
|
(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
module ThreeNumbersToNumber = {
|
||||||
|
let make = (name, fn) =>
|
||||||
|
FnDefinition.make(
|
||||||
|
~name,
|
||||||
|
~inputs=[FRTypeNumber, FRTypeNumber, FRTypeNumber],
|
||||||
|
~run=(_, inputs, _, _) => {
|
||||||
|
inputs->Prepare.ToValueTuple.threeNumbers->E.R2.fmap(fn)->E.R2.fmap(Wrappers.evNumber)
|
||||||
|
},
|
||||||
|
(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
let library = [
|
||||||
|
Function.make(
|
||||||
|
~name="laplace",
|
||||||
|
~nameSpace,
|
||||||
|
~requiresNamespace,
|
||||||
|
~output=EvtNumber,
|
||||||
|
~examples=[`laplace(1, 20)`],
|
||||||
|
~definitions=[
|
||||||
|
TwoNumbersToNumber.make("laplace", ((successes, trials)) =>
|
||||||
|
(successes +. 1.0) /. (trials +. 1.0)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
(),
|
||||||
|
),
|
||||||
|
]
|
|
@ -20,18 +20,6 @@ module NumberToNumber = {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
module TwoNumbersToNumber = {
|
|
||||||
let make = (name, fn) =>
|
|
||||||
FnDefinition.make(
|
|
||||||
~name,
|
|
||||||
~inputs=[FRTypeNumber, FRTypeNumber],
|
|
||||||
~run=(_, inputs, _, _) => {
|
|
||||||
inputs->Prepare.ToValueTuple.twoNumbers->E.R2.fmap(fn)->E.R2.fmap(Wrappers.evNumber)
|
|
||||||
},
|
|
||||||
(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
module ArrayNumberDist = {
|
module ArrayNumberDist = {
|
||||||
let make = (name, fn) => {
|
let make = (name, fn) => {
|
||||||
FnDefinition.make(
|
FnDefinition.make(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user