Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Dec 9, 2024
1 parent 8cc1a98 commit 80685d4
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion solutions/src/2024/09.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ moveAll files free = fst (Map.foldrWithKey' move1 (0, free) files)
-- contiguous free block.
move1 :: Int -> (Int, Int) -> (Int, Map Int Int) -> (Int, Map Int Int)
move1 offset (fileId, fileSize) (acc, free) =
seq acc $
case [(k, v) | (k, v) <- Map.assocs free, then takeWhile by k < offset, v >= fileSize] of
[] -> (acc + checksumOf offset fileId fileSize, free)
(k, v) : _ -> (acc + checksumOf k fileId fileSize, free')
Expand Down

0 comments on commit 80685d4

Please sign in to comment.