diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res index 4c92f479..26484cf4 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_Parse.res @@ -47,7 +47,7 @@ let parse = (expr: string): result => | Js.Exn.Error(obj) => REJs(Js.Exn.message(obj), Js.Exn.name(obj))->Error } -type mjNode = +type mathJsNode = | MjAccessorNode(accessorNode) | MjArrayNode(arrayNode) | MjConstantNode(constantNode) @@ -72,7 +72,7 @@ let castNodeType = (node: node) => | _ => RETodo(`Argg, unhandled MathJsNode: ${node["type"]}`)->Error } -let rec show = (mjNode: mjNode): string => { +let rec show = (mathJsNode: mathJsNode): string => { let showValue = (a: 'a): string => if Js.typeof(a) == "string" { `'${Js.String.make(a)}'` @@ -103,7 +103,7 @@ let rec show = (mjNode: mjNode): string => { ->Belt.Array.map(each => showResult(each->castNodeType)) ->Js.String.concatMany("") - switch mjNode { + switch mathJsNode { | MjAccessorNode(aNode) => `${aNode["object"]->showMathJsNode}[${aNode["index"]->showIndexNode}]` | MjArrayNode(aNode) => `[${aNode["items"]->showNodeArray}]` | MjConstantNode(cNode) => cNode["value"]->showValue @@ -115,9 +115,9 @@ let rec show = (mjNode: mjNode): string => { | MjSymbolNode(sNode) => sNode["name"] } } -and showResult = (rmjnode: result): string => - switch rmjnode { +and showResult = (rMathJsNode: result): string => + switch rMathJsNode { | Error(e) => showError(e) - | Ok(mjNode) => show(mjNode) + | Ok(mathJsNode) => show(mathJsNode) } and showMathJsNode = node => node->castNodeType->showResult diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_ToExpression.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_ToExpression.res index 1664877b..e7a7d805 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_ToExpression.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_MathJs/Reducer_MathJs_ToExpression.res @@ -9,8 +9,8 @@ type expression = ExtressionT.expression type expressionValue = ExpressionValue.expressionValue type errorValue = ErrorValue.errorValue -let rec fromNode = (mjnode: Parse.node): result => - Parse.castNodeType(mjnode)->Result.flatMap(typedMjNode => { +let rec fromNode = (mathJsNode: Parse.node): result => + Parse.castNodeType(mathJsNode)->Result.flatMap(typedMathJsNode => { let fromNodeList = (nodeList: list): result, 'e> => Belt.List.reduceReverse(nodeList, Ok(list{}), (racc, currNode) => racc->Result.flatMap(acc => @@ -52,9 +52,9 @@ let rec fromNode = (mjnode: Parse.node): result => let rpropertyCodeList = Belt.List.reduceReverse( iNode["dimensions"]->Belt.List.fromArray, Ok(list{}), - (racc, currentPropertyMjNode) => + (racc, currentPropertyMathJsNode) => racc->Result.flatMap(acc => - fromNode(currentPropertyMjNode)->Result.map(propertyCode => list{propertyCode, ...acc}) + fromNode(currentPropertyMathJsNode)->Result.map(propertyCode => list{propertyCode, ...acc}) ), ) rpropertyCodeList->Result.map(propertyCodeList => ExtressionT.EList(propertyCodeList)) @@ -70,7 +70,7 @@ let rec fromNode = (mjnode: Parse.node): result => }) } - switch typedMjNode { + switch typedMathJsNode { | MjArrayNode(aNode) => aNode["items"]->Belt.List.fromArray->fromNodeList->Result.map(list => ExtressionT.EList(list)) | MjConstantNode(cNode) =>