called lamda with arguments (tested)

This commit is contained in:
Umur Ozkul 2022-04-25 08:33:48 +02:00
parent 1fb9218a94
commit eba087329f

View File

@ -1,9 +1,11 @@
module Builder = Reducer_Expression_Builder
module BuiltIn = Reducer_Dispatch_BuiltIn module BuiltIn = Reducer_Dispatch_BuiltIn
module ExpressionValue = ReducerInterface.ExpressionValue module ExpressionValue = ReducerInterface.ExpressionValue
module Extra = Reducer_Extra module Extra = Reducer_Extra
module MathJs = Reducer_MathJs module MathJs = Reducer_MathJs
module Result = Belt.Result module Result = Belt.Result
module T = Reducer_Expression_T module T = Reducer_Expression_T
open Reducer_ErrorValue open Reducer_ErrorValue
type expression = T.expression type expression = T.expression
@ -75,14 +77,11 @@ let rec reduceExpression = (expression: t, bindings: T.bindings): result<express
let bindings = Belt.List.reduce(zippedParameterList, defaultBindings, (a, (p, e)) => let bindings = Belt.List.reduce(zippedParameterList, defaultBindings, (a, (p, e)) =>
a->Belt.Map.String.set(p, e->EValue) a->Belt.Map.String.set(p, e->EValue)
) )
Js.log(`applyParametersToLambda: ${toString(expr)}`) let newExpression = Builder.passToFunction(
let inspectBindings = "$$bindExpression",
bindings list{Builder.passToFunction("$$bindings", list{}), expr},
->Belt.Map.String.mapWithKey((k, v) => `${k}: ${toString(v)}`) )
->Belt.Map.String.valuesToArray reduceExpression(newExpression, bindings)
->Js.Array2.toString
Js.log(` inspectBindings: ${inspectBindings}`)
reduceExpression(expr, bindings)
} }
/* /*