summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-12-02 00:41:12 +1100
committerJed Barber <jjbarber@y7mail.com>2014-12-02 00:41:12 +1100
commit0e828db9689a06f1ebbdf338c0e796ec0495d526 (patch)
tree7f630ea65a9e01507261f64058e427396eef8ee4 /src
parenta697cfd93204e408fb9ac8363e3379f5a12e172e (diff)
Function to replace the GNode on top of the IP stack
Diffstat (limited to 'src')
-rw-r--r--src/Grasp/IP.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Grasp/IP.hs b/src/Grasp/IP.hs
index 6a4d452..294c92d 100644
--- a/src/Grasp/IP.hs
+++ b/src/Grasp/IP.hs
@@ -6,7 +6,8 @@ module Grasp.IP (
isEmpty,
peek,
push,
- pop
+ pop,
+ shift
) where
@@ -39,5 +40,8 @@ push :: GNode -> IP -> IP
push n (IP p) = IP (n:p)
pop :: IP -> IP
-pop (IP p) = if (length p == 0) then IP p else IP (tail p)
+pop (IP p) = if (length p == 0) then empty else IP (tail p)
+
+shift :: GNode -> IP -> IP
+shift n (IP p) = if (length p == 0) then empty else IP (n:(tail p))