Tweak display, scrolling of item values
This commit is contained in:
+15
-8
@@ -7,7 +7,8 @@ module Padding
|
||||
, midPadL
|
||||
, rotU
|
||||
, rotD
|
||||
, rotListAt
|
||||
-- , rotListAt
|
||||
, rotateList
|
||||
, insertAt
|
||||
)
|
||||
where
|
||||
@@ -45,13 +46,19 @@ rotD :: [a] -> [a]
|
||||
rotD [] = []
|
||||
rotD xs = last xs : init xs
|
||||
|
||||
rotListAt :: Eq a => a -> [a] -> [a]
|
||||
rotListAt x' xs = f x' xs []
|
||||
where
|
||||
f x (y:ys) zs
|
||||
| y == x = y:ys ++ zs
|
||||
| otherwise = f x ys (y:zs)
|
||||
f _ [] zs = zs
|
||||
rotateList :: Int -> [a] -> [a]
|
||||
rotateList i xs
|
||||
| i >= 0 = let (ys,zs) = splitAt i xs
|
||||
in zs ++ ys
|
||||
| otherwise = reverse . rotateList (-i) $ reverse xs
|
||||
|
||||
--rotListAt :: Eq a => a -> [a] -> [a]
|
||||
--rotListAt x' xs = f x' xs []
|
||||
-- where
|
||||
-- f x (y:ys) zs
|
||||
-- | y == x = y:ys ++ zs
|
||||
-- | otherwise = f x ys (y:zs)
|
||||
-- f _ [] zs = zs
|
||||
|
||||
insertAt :: Int -> a -> [a] -> [a]
|
||||
insertAt i x xs = let (ys,zs) = splitAt i xs in ys ++ [x] ++ zs
|
||||
|
||||
Reference in New Issue
Block a user