Skip to content

Commit

Permalink
replace List.flatten(listReverse(l)) by List.flattenReverse(l)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkiel authored and OpenModelica-Hudson committed Mar 31, 2016
1 parent 2eb7120 commit 29cc490
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Compiler/BackEnd/OnRelaxation.mo
Expand Up @@ -1472,7 +1472,7 @@ algorithm
mt := BackendDAEUtil.transposeMatrix(m, arrayLength(mt));
comps := Sorting.TarjanTransposed(mt, ass);
// BackendDump.dumpComponentsOLD(comps);
sortvorphans := List.flatten(listReverse(comps));
sortvorphans := List.flattenReverse(comps);
// map back to global indexes
sortvorphans := List.map1r(sortvorphans, arrayGet, map);
// print("sortvorphans: " + stringDelimitList(List.map(sortvorphans, intString), ", ") + "\n");
Expand Down
14 changes: 7 additions & 7 deletions Compiler/Parsers/SimpleModelicaParser.mo
Expand Up @@ -2201,10 +2201,10 @@ algorithm
addedTree := tree;
foundAdded := true;
if foundDeleted then
middle := List.flatten(listReverse(acc));
middle := List.flattenReverse(acc);
else
addedBeforeDeleted := true;
before := List.flatten(listReverse(acc));
before := List.flattenReverse(acc);
end if;
acc := {};
end if;
Expand All @@ -2223,10 +2223,10 @@ algorithm
deletedTree := tree;
foundDeleted := true;
if foundAdded then
middle := List.flatten(listReverse(acc));
middle := List.flattenReverse(acc);
else
addedBeforeDeleted := false;
before := List.flatten(listReverse(acc));
before := List.flattenReverse(acc);
end if;
acc := {};
end if;
Expand All @@ -2244,7 +2244,7 @@ algorithm
end for;
true := foundAdded;
true := foundDeleted;
after := List.flatten(listReverse(acc));
after := List.flattenReverse(acc);
end extractSingleAddDiffBeforeAndAfter;

function extractAdditionsDeletions
Expand All @@ -2267,8 +2267,8 @@ algorithm
else ();
end match;
end for;
addedTrees := List.flatten(listReverse(addedTreesAcc));
deletedTrees := List.flatten(listReverse(deletedTreesAcc));
addedTrees := List.flattenReverse(addedTreesAcc);
deletedTrees := List.flattenReverse(deletedTreesAcc);
end extractAdditionsDeletions;

function countDiffAddDelete
Expand Down
13 changes: 6 additions & 7 deletions Compiler/SimCode/SimCodeUtil.mo
Expand Up @@ -1330,10 +1330,10 @@ algorithm
foldArg := List.fold1(comps, createEquationsForSystem1, arg, foldArg);
(ouniqueEqIndex, odeEquations, algebraicEquations, allEquations, equationsforZeroCrossings,
otempvars, oeqSccMapping, oeqBackendSimCodeMapping, oBackendMapping, _) := foldArg;
outOdeEquations := List.flatten(listReverse(odeEquations));
outAlgebraicEquations := List.flatten(listReverse(algebraicEquations));
outAllEquations := List.flatten(listReverse(allEquations));
outEquationsforZeroCrossings := List.flatten(listReverse(equationsforZeroCrossings));
outOdeEquations := List.flattenReverse(odeEquations);
outAlgebraicEquations := List.flattenReverse(algebraicEquations);
outAllEquations := List.flattenReverse(allEquations);
outEquationsforZeroCrossings := List.flattenReverse(equationsforZeroCrossings);
end createEquationsForSystem;

protected function addEquationsToLists
Expand Down Expand Up @@ -1609,7 +1609,7 @@ algorithm
BackendDAE.ExtraInfo ei;

// handle empty
case (_, _, _, _, _, _, {}, _, _, _, _) then (List.flatten(listReverse(accEquations)), List.flatten(listReverse(accNoDiscEquations)), iuniqueEqIndex, itempvars);
case (_, _, _, _, _, _, {}, _, _, _, _) then (List.flattenReverse(accEquations), List.flattenReverse(accNoDiscEquations), iuniqueEqIndex, itempvars);

// ignore when equations if we should not generate them
case (_, _, _, _, _, _, comp :: restComps, _, _, _, _)
Expand Down Expand Up @@ -4470,8 +4470,7 @@ algorithm
// select all discrete vars.
// remove those vars that are solved in when equations
// replace var with cref
vLst2 = BackendVariable.traverseBackendDAEVars(v, traversingisVarDiscreteCrefFinder, {});
vLst2 = listAppend(vLst2, acc);
vLst2 = BackendVariable.traverseBackendDAEVars(v, traversingisVarDiscreteCrefFinder, acc);
// vLst2 = List.unionOnTrue(vLst2, vLst1, ComponentReference.crefEqual);
then vLst2;
else
Expand Down

0 comments on commit 29cc490

Please sign in to comment.