Tweak display, scrolling of item values

This commit is contained in:
2025-01-07 21:10:29 +00:00
parent b3cf10bd26
commit 5fa5bdf21e
18 changed files with 367 additions and 384 deletions
+15 -8
View File
@@ -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