tweak: In Danger namespace, further diminishingMarginalReturnsSkeleton
This commit is contained in:
parent
aa3173f85b
commit
fe3075b3bf
|
@ -69,8 +69,8 @@ module Internals = {
|
|||
result
|
||||
}
|
||||
let castFloatToInternalNumber = x => ReducerInterface_InternalExpressionValue.IEvNumber(x)
|
||||
@dead
|
||||
let applyFunctionAtFloat = (aLambda, point, environment, reducer) =>
|
||||
let castArrayOfFloatsToInternalArrayOfInternals = xs => ReducerInterface_InternalExpressionValue.IEvArray(Belt.Array.map(xs, x => castFloatToInternalNumber(x)))
|
||||
@dead let applyFunctionAtFloat = (aLambda, point, environment, reducer) =>
|
||||
// reason for existence: might be an useful template to have for calculating diminishing marginal returns later on
|
||||
applyFunctionAtPoint(aLambda, castFloatToInternalNumber(point), environment, reducer)
|
||||
// integrate function itself
|
||||
|
@ -176,7 +176,7 @@ module Internals = {
|
|||
environment,
|
||||
reducer,
|
||||
) => {
|
||||
Ok(castFloatToInternalNumber(0.0))
|
||||
Ok(castArrayOfFloatsToInternalArrayOfInternals([0.0, 1.0]))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ let library = [
|
|||
Function.make(
|
||||
~name="diminishingMarginalReturnsSkeleton",
|
||||
~nameSpace,
|
||||
~output=EvtNumber,
|
||||
~output=EvtArray,
|
||||
~requiresNamespace=false,
|
||||
~examples=[`Danger.diminishingMarginalReturnsSkeleton({|x| x+1}, {|y| 10}, 100, 1)`],
|
||||
~definitions=[
|
||||
|
|
|
@ -75,7 +75,8 @@ module Internals = {
|
|||
})
|
||||
})
|
||||
)
|
||||
rMappedList->E.R2.fmap(mappedList => mappedList->Belt.List.toArray->Wrappers.evArray)
|
||||
let result = rMappedList->E.R2.fmap(mappedList => mappedList->Belt.List.toArray->Wrappers.evArray)
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,10 +191,13 @@ let library = [
|
|||
~name="map",
|
||||
~inputs=[FRTypeArray(FRTypeAny), FRTypeLambda],
|
||||
~run=(inputs, _, env, reducer) =>
|
||||
switch inputs {
|
||||
{
|
||||
let result = switch inputs {
|
||||
| [IEvArray(array), IEvLambda(lambda)] =>
|
||||
Internals.map(array, env, lambda, reducer)->E.R2.errMap(_ => "Error!")
|
||||
| _ => Error(impossibleError)
|
||||
}
|
||||
result
|
||||
},
|
||||
(),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue
Block a user