squiggle/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res
Umur Ozkul 8e318a8aa9 refactor reducer
removed some extra array references

rename Builder to ExpressionBuilder

Expression Builder

Trash Warning

remove parsePartial/Outer, add context to lambda

format

module Bindings

simplify types

module Macro

reduceValueList

do macro call

result map

bindings stop replacing on macro calls

Macro Test

doBindStatement

bind a statement

bindings tested. TODO bind shadowing in lambda

block tests defined

block tests defined

blocks tested

macro lambda test defined
2022-04-29 16:40:32 +02:00

13 lines
421 B
Plaintext

open Jest
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))))))")
//MathJs does not allow blocks in function definitions
})
describe("Evaluate function assignment", () => {
testEvalToBe("f(x)=x; f(1)", "Ok(1)")
})