finally nailed the triggers! (I hope)

This commit is contained in:
Quinn Dougherty 2022-04-11 01:08:54 -04:00
parent d4b00b15c1
commit 3689caa1fc
2 changed files with 11 additions and 24 deletions

View File

@ -37,7 +37,7 @@ jobs:
name: Language lint name: Language lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: pre_check needs: pre_check
if: ${{ !needs.pre_check.outputs.should_skip_lang }} if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
defaults: defaults:
run: run:
shell: bash shell: bash
@ -91,7 +91,7 @@ jobs:
name: Website build name: Website build
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: pre_check needs: pre_check
if: ${{ !(needs.pre_check.outputs.should_skip_website && needs.pre_check.outputs.should_skip_lang && needs.pre_check.outputs.should_skip_components) }} if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }}
defaults: defaults:
run: run:
shell: bash shell: bash

View File

@ -121,17 +121,14 @@ module MathAdtToDistDst = {
| (_, _, Ok(mu), Ok(sigma)) => Ok(#FunctionCall("lognormal", [mu, sigma])) | (_, _, Ok(mu), Ok(sigma)) => Ok(#FunctionCall("lognormal", [mu, sigma]))
| _ => Error("Lognormal distribution needs either mean and stdev or mu and sigma") | _ => Error("Lognormal distribution needs either mean and stdev or mu and sigma")
} }
| _ => | _ => parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) => #FunctionCall("lognormal", args))
parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) =>
#FunctionCall("lognormal", args)
)
} }
// Error("Dotwise exponentiation needs two operands") // Error("Dotwise exponentiation needs two operands")
let operationParser = ( let operationParser = (name: string, args: result<array<ASTTypes.node>, string>): result<
name: string, ASTTypes.node,
args: result<array<ASTTypes.node>, string>, string,
): result<ASTTypes.node, string> => { > => {
let toOkAlgebraic = r => Ok(#AlgebraicCombination(r)) let toOkAlgebraic = r => Ok(#AlgebraicCombination(r))
let toOkPointwise = r => Ok(#PointwiseCombination(r)) let toOkPointwise = r => Ok(#PointwiseCombination(r))
let toOkTruncate = r => Ok(#Truncate(r)) let toOkTruncate = r => Ok(#Truncate(r))
@ -169,10 +166,7 @@ module MathAdtToDistDst = {
} }
let functionParser = ( let functionParser = (
nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t< nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t<ASTTypes.node, string>,
ASTTypes.node,
string,
>,
name: string, name: string,
args: array<MathJsonToMathJsAdt.arg>, args: array<MathJsonToMathJsAdt.arg>,
): result<ASTTypes.node, string> => { ): result<ASTTypes.node, string> => {
@ -224,17 +218,11 @@ module MathAdtToDistDst = {
) )
Ok(hash) Ok(hash)
} }
| name => | name => parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) => #FunctionCall(name, args))
parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) =>
#FunctionCall(name, args)
)
} }
} }
let rec nodeParser: MathJsonToMathJsAdt.arg => result< let rec nodeParser: MathJsonToMathJsAdt.arg => result<ASTTypes.node, string> = x =>
ASTTypes.node,
string,
> = x =>
switch x { switch x {
| Value(f) => Ok(#SymbolicDist(#Float(f))) | Value(f) => Ok(#SymbolicDist(#Float(f)))
| Symbol(sym) => Ok(#Symbol(sym)) | Symbol(sym) => Ok(#Symbol(sym))
@ -267,8 +255,7 @@ module MathAdtToDistDst = {
blocks |> E.A.fmap(b => topLevel(b)) |> E.A.R.firstErrorOrOpen |> E.R.fmap(E.A.concatMany) blocks |> E.A.fmap(b => topLevel(b)) |> E.A.R.firstErrorOrOpen |> E.R.fmap(E.A.concatMany)
} }
let run = (r): result<ASTTypes.program, string> => let run = (r): result<ASTTypes.program, string> => r |> MathAdtCleaner.run |> topLevel
r |> MathAdtCleaner.run |> topLevel
} }
/* The MathJs parser doesn't support '.+' syntax, but we want it because it /* The MathJs parser doesn't support '.+' syntax, but we want it because it