File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,16 @@ public function map<TI, TO>
130
130
end FuncType ;
131
131
protected
132
132
Integer len := arrayLength(inArray);
133
+ TO res;
133
134
algorithm
134
135
// If the array is empty, use list transformations to fix the types!
135
136
if len == 0 then
136
137
outArray := listArray({});
137
138
else
138
139
// If the array isn't empty, use the first element to create the new array.
139
- outArray := arrayCreateNoInit(len, inFunc(arrayGetNoBoundsChecking(inArray, 1 )));
140
+ res := inFunc(arrayGetNoBoundsChecking(inArray, 1 ));
141
+ outArray := arrayCreateNoInit(len, res);
142
+ arrayUpdate(outArray, 1 , res);
140
143
141
144
for i in 2 :len loop
142
145
arrayUpdate(outArray, i, inFunc(arrayGetNoBoundsChecking(inArray, i)));
You can’t perform that action at this time.
0 commit comments