summaryrefslogtreecommitdiff
path: root/WriteProof.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-07-12 09:25:03 +1000
committerJed Barber <jjbarber@y7mail.com>2012-07-12 09:25:03 +1000
commit070b4f30ed74ba4ac88289f1c1f6a8ab55f62382 (patch)
tree3e68f396c4e209c4757eaee01695bbd4d302d8a8 /WriteProof.hs
parenta489bbd5fb9f6a2a97243dd95b580080bb83272d (diff)
Fixed selection of new dictionary indices
Diffstat (limited to 'WriteProof.hs')
-rw-r--r--WriteProof.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/WriteProof.hs b/WriteProof.hs
index db69aa1..00c4802 100644
--- a/WriteProof.hs
+++ b/WriteProof.hs
@@ -45,10 +45,12 @@ cost graph node =
-next :: Eq a => [a] -> a -> (a -> a) -> a
-next list start suc =
- let f = (\x y -> if (x `elem` y) then f (suc x) y else x)
- in f start list
+next :: Gr String (Int,Int) -> String
+next graph =
+ let nodeList = filter (isNumber . snd) (Graph.labNodes graph)
+ numList = nub . (map (read . snd)) $ nodeList
+ f = (\x y -> if (x `elem` y) then f (x + 1) y else x)
+ in show (f 0 numList)
@@ -86,7 +88,7 @@ singleCommands :: Gr String (Int,Int) -> [Node] -> Gr String (Int,Int)
singleCommands graph nodeList =
let r = (\g n p -> let g' = if (((output g n) /= 1) || ((Graph.indeg g n) == 1) || ((cost g n) < 3) || ((cost g n) == 3 && (Graph.indeg g n) < 3))
then g
- else let index = show . length . nub $ (filter (isNumber . snd) (Graph.labNodes g))
+ else let index = next g --show . length . (nubBy (\x y -> snd x == snd y)) $ (filter (isNumber . snd) (Graph.labNodes g))
new = Graph.newNodes 4 g -- 2 new nodes for def and 2 new nodes for ref
oldEdge = head $ (filter (\x -> fst3 x == p) (Graph.inn g n))