Rehome launcher

This commit is contained in:
jgk
2021-05-25 18:03:35 +02:00
parent f737897b18
commit d5fed6c987
15 changed files with 280 additions and 222 deletions
+4
View File
@@ -3,6 +3,7 @@ module IntMapHelp
, newKey
, insertNewKey
, insertWithNewKeys
, swapKeys
)
where
--import Data.List hiding (foldr,insert)
@@ -19,3 +20,6 @@ insertNewKey x m = case lookupMax m of
{- | Insert a list of values with new keys -}
insertWithNewKeys :: [a] -> IntMap a -> IntMap a
insertWithNewKeys xs m = union m $ fromList $ zip [newKey m..] xs
{- | Swaps two keys. Unsafe: assumes both keys exist. -}
swapKeys :: Int -> Int -> IntMap a -> IntMap a
swapKeys i j m = insert i (m ! j) $ insert j (m ! i) m