Commit d4f62d4e authored by Iustin Pop's avatar Iustin Pop
Browse files

Replace a foldl by foldl'

parent 4e25d1c2
......@@ -613,19 +613,19 @@ fixNodes :: [(Int, Node.Node)]
-> [(Int, Instance.Instance)]
-> [(Int, Node.Node)]
fixNodes nl il =
foldl (\accu (idx, inst) ->
let
assocEqual = (\ (i, _) (j, _) -> i == j)
pdx = Instance.pnode inst
sdx = Instance.snode inst
pold = fromJust $ lookup pdx accu
sold = fromJust $ lookup sdx accu
pnew = Node.setPri pold idx
snew = Node.setSec sold idx
ac1 = deleteBy assocEqual (pdx, pold) accu
ac2 = deleteBy assocEqual (sdx, sold) ac1
ac3 = (pdx, pnew):(sdx, snew):ac2
in ac3) nl il
foldl' (\accu (idx, inst) ->
let
assocEqual = (\ (i, _) (j, _) -> i == j)
pdx = Instance.pnode inst
sdx = Instance.snode inst
pold = fromJust $ lookup pdx accu
sold = fromJust $ lookup sdx accu
pnew = Node.setPri pold idx
snew = Node.setSec sold idx
ac1 = deleteBy assocEqual (pdx, pold) accu
ac2 = deleteBy assocEqual (sdx, sold) ac1
ac3 = (pdx, pnew):(sdx, snew):ac2
in ac3) nl il
{-| Initializer function that loads the data from a node and list file
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment