summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-06-14 09:27:08 +1000
committerJed Barber <jjbarber@y7mail.com>2012-06-14 09:27:08 +1000
commit9cd2944ce482eeb2ac91b415023189fe10c66ec1 (patch)
treee1ea912c0f9d0e0d7f0494816bd1985b5d6b17d6
parent533dcc1b4ab16bf167a8f9b08000be30cd0a39c2 (diff)
Fixed bug with remove/ref
-rw-r--r--Graph.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Graph.hs b/Graph.hs
index 8fdc399..38feaab 100644
--- a/Graph.hs
+++ b/Graph.hs
@@ -75,12 +75,12 @@ parse gs@(graph,stack,dictionary) str =
"ref" -> let num = read . contents . fromJust $ stack `at` 0
node = fromJust (Map.lookup num dictionary)
- stack' = node <:> stack
+ stack' = node <:> (Stack.pop 1 stack)
in (graph, stack', dictionary)
"remove" -> let num = read . contents . fromJust $ stack `at` 0
node = fromJust (Map.lookup num dictionary)
- stack' = node <:> stack
+ stack' = node <:> (Stack.pop 1 stack)
dictionary' = Map.delete num dictionary
in (graph, stack', dictionary')
@@ -106,5 +106,5 @@ main = do
args <- getArgs
list <- getLines $ head args
let result = doGraphGen (map (stripReturn) list)
- printf $ show result
+ printf $ show (case result of (graph, state, dictionary) -> graph)