From feb0284a899c76b8de8b12ad922e62e0fbba2dc9 Mon Sep 17 00:00:00 2001 From: Umur Ozkul Date: Fri, 20 May 2022 18:20:00 +0200 Subject: [PATCH] format --- .../Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res | 7 +++++-- .../Reducer_Peggy/Reducer_Peggy_ToExpression_test.res | 8 ++++++-- .../__tests__/Reducer/Reducer_functionAssignment_test.res | 5 ++++- .../ReducerInterface_Distribution_test.res | 5 ++++- .../Reducer_Dispatch/Reducer_Dispatch_BuiltInMacros.res | 3 ++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res index 3c2381cb..168be4d8 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res @@ -131,7 +131,10 @@ describe("Peggy parse", () => { describe("ternary operator", () => { testParse("true ? 2 : 3", "{(::$$_ternary_$$ true 2 3)}") - testParse("false ? 2 : false ? 4 : 5", "{(::$$_ternary_$$ false 2 (::$$_ternary_$$ false 4 5))}") // nested ternary + testParse( + "false ? 2 : false ? 4 : 5", + "{(::$$_ternary_$$ false 2 (::$$_ternary_$$ false 4 5))}", + ) // nested ternary }) describe("if then else", () => { @@ -188,7 +191,7 @@ describe("Peggy parse", () => { testParse("1 -> subtract(2) * 3", "{(::multiply (::subtract 1 2) 3)}") }) - describe("elixir pipe", () => { + describe("elixir pipe", () => { //handled together with -> so there is no need for seperate tests testParse("1 |> add(2)", "{(::add 1 2)}") }) diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res index 2c676c8f..81bafd97 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_ToExpression_test.res @@ -80,7 +80,12 @@ describe("Peggy to Expression", () => { (), ) // Function definitions become lambda assignments testToExpression("identity(x)", "(:$$_block_$$ (:identity :x))", ()) // Note value returns error properly - testToExpression("f(x) = x> 2 ? 0 : 1; f(3)", "(:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ (:$$_ternary_$$ (:larger :x 2) 0 1)))) (:f 3))", ~v="0", ()) + testToExpression( + "f(x) = x> 2 ? 0 : 1; f(3)", + "(:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ (:$$_ternary_$$ (:larger :x 2) 0 1)))) (:f 3))", + ~v="0", + (), + ) }) describe("arrays", () => { @@ -184,7 +189,6 @@ describe("Peggy to Expression", () => { ~v="{x: 1,y: 99}", (), ) - }) describe("lambda", () => { diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res index 2bd1498a..0f280265 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res @@ -3,7 +3,10 @@ open Reducer_TestHelpers describe("Parse function assignment", () => { testParseToBe("f(x)=x", "Ok((:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ :x)))))") - testParseToBe("f(x)=2*x", "Ok((:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ (:multiply 2 :x))))))") + testParseToBe( + "f(x)=2*x", + "Ok((:$$_block_$$ (:$_let_$ :f (:$$_lambda_$$ [x] (:$$_block_$$ (:multiply 2 :x))))))", + ) //MathJs does not allow blocks in function definitions }) diff --git a/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res b/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res index 4e4d12ff..bc95f160 100644 --- a/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res +++ b/packages/squiggle-lang/__tests__/ReducerInterface/ReducerInterface_Distribution_test.res @@ -147,7 +147,10 @@ describe("parse on distribution functions", () => { "normal(5,2) ./ normal(5,1)", "Ok((:$$_block_$$ (:dotDivide (:normal 5 2) (:normal 5 1))))", ) - testParse("normal(5,2) .^ normal(5,1)", "Ok((:$$_block_$$ (:dotPow (:normal 5 2) (:normal 5 1))))") + testParse( + "normal(5,2) .^ normal(5,1)", + "Ok((:$$_block_$$ (:dotPow (:normal 5 2) (:normal 5 1))))", + ) }) describe("equality", () => { testParse("5 == normal(5,2)", "Ok((:$$_block_$$ (:equal 5 (:normal 5 2))))") diff --git a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltInMacros.res b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltInMacros.res index f0fd08b3..1fba533f 100644 --- a/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltInMacros.res +++ b/packages/squiggle-lang/src/rescript/Reducer/Reducer_Dispatch/Reducer_Dispatch_BuiltInMacros.res @@ -174,7 +174,8 @@ let dispatchMacroCall = ( | list{ExpressionT.EValue(EvCall("$$_bindExpression_$$")), expression} => // bindings of the context are used when there is no binding expression doBindExpression(eRecord(Bindings.toExternalBindings(bindings)), expression, environment) - | list{ExpressionT.EValue(EvCall("$$_block_$$")), ...exprs} => doBlock(exprs, bindings, environment) + | list{ExpressionT.EValue(EvCall("$$_block_$$")), ...exprs} => + doBlock(exprs, bindings, environment) | list{ ExpressionT.EValue(EvCall("$$_lambda_$$")), ExpressionT.EValue(EvArrayString(parameters)),