fixed - PR#333 kill W in evaluatePartialWBindings

renamed to evaluatePartialUsingExternalBindings
This commit is contained in:
Umur Ozkul 2022-04-22 22:19:59 +02:00
parent 2c7e6c750b
commit 875f0519ac
4 changed files with 6 additions and 6 deletions

View File

@ -24,7 +24,7 @@ let expectEvalPartialBindingsToBe = (
bindings: Reducer.externalBindings, bindings: Reducer.externalBindings,
answer: string, answer: string,
) => ) =>
Reducer.evaluatePartialWBindings(expr, bindings) Reducer.evaluatePartialUsingExternalBindings(expr, bindings)
->ExpressionValue.toStringResultRecord ->ExpressionValue.toStringResultRecord
->expect ->expect
->toBe(answer) ->toBe(answer)

View File

@ -9,7 +9,7 @@ type expressionValue = Reducer_Expression.expressionValue
type externalBindings = Expression.externalBindings type externalBindings = Expression.externalBindings
let evaluate = Expression.eval let evaluate = Expression.eval
let evaluateUsingExternalBindings = Expression.evalUsingExternalBindings let evaluateUsingExternalBindings = Expression.evalUsingExternalBindings
let evaluatePartialWBindings = Expression.evalPartialWBindings let evaluatePartialUsingExternalBindings = Expression.evalPartialUsingExternalBindings
let parse = Expression.parse let parse = Expression.parse
let parseOuter = Expression.parseOuter let parseOuter = Expression.parseOuter
let parsePartial = Expression.parsePartial let parsePartial = Expression.parsePartial

View File

@ -17,7 +17,7 @@ let evaluateUsingExternalBindings: (
externalBindings, externalBindings,
) => result<expressionValue, Reducer_ErrorValue.errorValue> ) => result<expressionValue, Reducer_ErrorValue.errorValue>
@genType @genType
let evaluatePartialWBindings: ( let evaluatePartialUsingExternalBindings: (
string, string,
externalBindings, externalBindings,
) => result<externalBindings, Reducer_ErrorValue.errorValue> ) => result<externalBindings, Reducer_ErrorValue.errorValue>

View File

@ -124,7 +124,7 @@ let evalUsingExternalBindingsExpression_ = (aExpression, bindings): result<expre
When bindings are used, the code is a partial code as if it is cut from a larger code. When bindings are used, the code is a partial code as if it is cut from a larger code.
Therefore all statements are assignments. Therefore all statements are assignments.
*/ */
let evalPartialWBindings_ = (codeText: string, bindings: T.bindings) => { let evalPartialUsingExternalBindings_ = (codeText: string, bindings: T.bindings) => {
parsePartial(codeText)->Result.flatMap(expression => parsePartial(codeText)->Result.flatMap(expression =>
expression->evalUsingExternalBindingsExpression_(bindings) expression->evalUsingExternalBindingsExpression_(bindings)
) )
@ -169,12 +169,12 @@ let evalUsingExternalBindings = (code: string, externalBindings: externalBinding
Evaluates code with external bindings. External bindings are a record of expression values. Evaluates code with external bindings. External bindings are a record of expression values.
The code is a partial code as if it is cut from a larger code. Therefore all statments are assignments. The code is a partial code as if it is cut from a larger code. Therefore all statments are assignments.
*/ */
let evalPartialWBindings = (code: string, externalBindings: externalBindings): result< let evalPartialUsingExternalBindings = (code: string, externalBindings: externalBindings): result<
externalBindings, externalBindings,
'e, 'e,
> => { > => {
let bindings = externalBindings->externalBindingsToBindings let bindings = externalBindings->externalBindingsToBindings
let answer = evalPartialWBindings_(code, bindings) let answer = evalPartialUsingExternalBindings_(code, bindings)
answer->Result.flatMap(answer => answer->Result.flatMap(answer =>
switch answer { switch answer {
| EvRecord(aRecord) => Ok(aRecord) | EvRecord(aRecord) => Ok(aRecord)