slightly faster map implementation

see this comment: https://github.com/quantified-uncertainty/squiggle/pull/1047#issuecomment-1241805927
This commit is contained in:
Vyacheslav Matyukhin 2022-09-09 14:39:42 +04:00
parent ecc82ba8f7
commit 4d1f76f80e
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C

View File

@ -33,16 +33,14 @@ module Internals = {
eLambdaValue, eLambdaValue,
reducer: ProjectReducerFnT.t, reducer: ProjectReducerFnT.t,
): ReducerInterface_InternalExpressionValue.t => { ): ReducerInterface_InternalExpressionValue.t => {
let mappedList = array->E.A.reduceReverse(list{}, (acc, elem) => { Belt.Array.map(array, elem =>
let newElem = Reducer_Expression_Lambda.doLambdaCall( Reducer_Expression_Lambda.doLambdaCall(
eLambdaValue, eLambdaValue,
list{elem}, list{elem},
(accessors: ProjectAccessorsT.t), (accessors: ProjectAccessorsT.t),
(reducer: ProjectReducerFnT.t), (reducer: ProjectReducerFnT.t),
) )
list{newElem, ...acc} )->Wrappers.evArray
})
mappedList->Belt.List.toArray->Wrappers.evArray
} }
let reduce = ( let reduce = (