diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-09-28 00:47:29 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-09-28 00:47:29 +1000 |
commit | adcd3d4d04ed1fddf6c127d17dac6c3fefed407a (patch) | |
tree | 25edcc9262867074c6db6ced3510a32aaae565ff | |
parent | 02060edfb27d906035215f9afd0f1bf13838264c (diff) |
Added function to compute the difference of two stacks
-rw-r--r-- | Library/Stack.hs | 8 |
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) + |