mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-07 23:41:52 -07:00
improve changeMosaic.
This commit is contained in:
14
Mosaic.hs
14
Mosaic.hs
@@ -319,9 +319,17 @@ lengthM (M x) = sum $ map lengthM x
|
|||||||
|
|
||||||
changeMosaic :: Mosaic a -> [Mosaic a]
|
changeMosaic :: Mosaic a -> [Mosaic a]
|
||||||
changeMosaic (OM a) = []
|
changeMosaic (OM a) = []
|
||||||
changeMosaic (M xs) = [makeM $ reverse xs] ++
|
changeMosaic (M xs) = map makeM (concatenations xs) ++
|
||||||
map makeM (concatenations xs) ++
|
map makeM (splits xs) ++
|
||||||
map makeM (splits xs) -- should also change the lower level
|
map M (tryAll changeMosaic xs)
|
||||||
|
|
||||||
|
tryAll :: (a -> [a]) -> [a] -> [[a]]
|
||||||
|
tryAll _ [] = []
|
||||||
|
tryAll f (x:xs) = map (:xs) (f x) ++ map (x:) (tryAll f xs)
|
||||||
|
|
||||||
|
onceToEach :: (a -> a) -> [a] -> [[a]]
|
||||||
|
onceToEach _ [] = []
|
||||||
|
onceToEach f (x:xs) = (f x : xs) : map (x:) (onceToEach f xs)
|
||||||
|
|
||||||
splits :: [Mosaic a] -> [[Mosaic a]]
|
splits :: [Mosaic a] -> [[Mosaic a]]
|
||||||
splits [] = []
|
splits [] = []
|
||||||
|
Reference in New Issue
Block a user