2022-05-21 17:52:17 +00:00
|
|
|
# Function Registry
|
|
|
|
|
|
|
|
The function registry is a library for organizing function definitions.
|
|
|
|
|
|
|
|
The main interface is fairly constrained. Basically, write functions like the following, and add them to a big array.
|
|
|
|
|
|
|
|
```rescript
|
|
|
|
Function.make(
|
|
|
|
~name="Normal",
|
|
|
|
~definitions=[
|
|
|
|
FnDefinition.make(
|
|
|
|
~name="Normal",
|
|
|
|
~definitions=[
|
|
|
|
FnDefinition.make(~name="normal", ~inputs=[FRTypeDistOrNumber, FRTypeDistOrNumber], ~run=(
|
|
|
|
inputs,
|
|
|
|
env,
|
|
|
|
) =>
|
|
|
|
inputs
|
|
|
|
->Prepare.ToValueTuple.twoDistOrNumber
|
|
|
|
->E.R.bind(
|
|
|
|
Process.twoDistsOrNumbersToDistUsingSymbolicDist(
|
|
|
|
~fn=E.Tuple2.toFnCall(SymbolicDist.Normal.make),
|
|
|
|
~env,
|
|
|
|
~values=_,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
->E.R2.fmap(Wrappers.evDistribution)
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
The Function name is just there for future documentation. The function defintions
|
|
|
|
|
|
|
|
## Key Files
|
|
|
|
|
|
|
|
**FunctionRegistry_Core**
|
2022-05-23 18:28:32 +00:00
|
|
|
Key types, internal functionality, and a `Registry` module with a `matchAndRun` function to call function definitions.
|
2022-05-21 17:52:17 +00:00
|
|
|
|
|
|
|
**FunctionRegistry_Library**
|
|
|
|
A list of all the Functions defined in the Function Registry.
|
|
|
|
|
|
|
|
**FunctionRegistry_Helpers**
|
2022-05-23 18:28:32 +00:00
|
|
|
A list of helper functions for the FunctionRegistry_Library.
|