Rehome launcher
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user