Move toward indexed external placements
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user