add differentiate function to StackSet to go [a] -> Stack a.

This commit is contained in:
David Roundy
2007-06-12 13:28:53 +00:00
parent 00e1038d71
commit 4ffee115e1

View File

@@ -75,7 +75,7 @@
module StackSet (
StackSet(..), Workspace(..), Screen(..), Stack(..), RationalRect(..),
new, view, lookupWorkspace, peek, index, integrate, focusUp, focusDown,
new, view, lookupWorkspace, peek, index, integrate, differentiate, focusUp, focusDown,
focusWindow, member, findIndex, insertUp, delete, shift, filter,
swapMaster, swapUp, swapDown, modify, float, sink -- needed by users
) where
@@ -262,6 +262,13 @@ integrate :: Stack a -> [a]
integrate Empty = []
integrate (Node x l r) = reverse l ++ x : r
-- |
-- /O(n)/. Texture a list.
--
differentiate :: [a] -> Stack a
differentiate [] = Empty
differentiate (x:xs) = Node x [] xs
-- |
-- /O(n)/. 'filter p s' returns the elements of 's' such that 'p' evaluates to
-- True. Order is preserved, and focus moves to the next node to the right (if