Move toward indexed external placements

This commit is contained in:
2021-11-15 19:36:31 +00:00
parent 59dc24aff6
commit a7f2b5f3ea
9 changed files with 63 additions and 32 deletions
+9
View File
@@ -6,6 +6,7 @@ module Padding
, midPadL
, rotU
, rotD
, rotListAt
)
where
leftPad :: Int -> a -> [a] -> [a]
@@ -37,3 +38,11 @@ rotD :: [a] -> [a]
{-# INLINE rotD #-}
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