summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2012-09-28 00:47:29 +1000
committerJed Barber <jjbarber@y7mail.com>2012-09-28 00:47:29 +1000
commitadcd3d4d04ed1fddf6c127d17dac6c3fefed407a (patch)
tree25edcc9262867074c6db6ced3510a32aaae565ff
parent02060edfb27d906035215f9afd0f1bf13838264c (diff)
Added function to compute the difference of two stacks
-rw-r--r--Library/Stack.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Library/Stack.hs b/Library/Stack.hs
index 29dd17c..99cd8e1 100644
--- a/Library/Stack.hs
+++ b/Library/Stack.hs
@@ -4,7 +4,8 @@ module Library.Stack (
at,
pop,
(<:>),
- size
+ size,
+ diff
) where
@@ -42,3 +43,8 @@ x <:> (Stack list) = Stack (x : list)
size :: Stack a -> Int
size (Stack list) = length list
+
+
+diff :: (Eq a) => Stack a -> Stack a -> Stack a
+diff (Stack one) (Stack two) = Stack (one \\ two)
+