squiggle/src/models/Human.re
2020-02-26 09:36:26 +00:00

39 lines
923 B
ReasonML

let guesstimatorString = age => GuesstimatorDist.normal(80.0 -. age, 2.);
let makeI = (age: float) => {
DistPlusIngredients.make(
~guesstimatorString=guesstimatorString(age),
~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `years}),
~domain=RightLimited({xPoint: 300.0, excludingProbabilityMass: 0.3}),
(),
);
};
module Model = {
let make = (age: float) => {
Prop.Value.DistPlusIngredients(makeI(age));
};
};
module Interface = {
let ageKey = "age";
let run = (p: array(option(Prop.Value.t))) => {
switch (p) {
| [|Some(FloatPoint(age))|] => Some(Model.make(age))
| _ => None
};
};
let model: Prop.Model.t =
Prop.{
name: "Death Time",
id: "human-lifespan",
description: "When will you die?",
version: "1.0.0",
author: "Ozzie Gooen",
inputTypes: [|TypeWithMetadata.age|],
outputTypes: [||],
run,
};
};