projects
/
advent-of-code-22.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1ade0f9
)
With catMaybes
author
Neil Smith
<NeilNjae@users.noreply.github.com>
Mon, 5 Dec 2022 11:38:38 +0000
(11:38 +0000)
committer
Neil Smith
<NeilNjae@users.noreply.github.com>
Mon, 5 Dec 2022 11:38:38 +0000
(11:38 +0000)
advent05/Main.hs
patch
|
blob
|
history
diff --git
a/advent05/Main.hs
b/advent05/Main.hs
index 727822d430fb7f17d14aac9e4f40d526a7ddfe04..21daf434eb0f17035f9b4542a926e88e56235291 100644
(file)
--- a/
advent05/Main.hs
+++ b/
advent05/Main.hs
@@
-52,9
+52,7
@@
extractName (Crate c) = c
makeWharf :: [[Maybe Crate]] -> [Int] -> Wharf
makeWharf wharfLines colNames = M.fromList $ zip colNames wharfCols
- where wharfCols = fmap (fmap fromJust)
- $ fmap (dropWhile isNothing)
- $ transpose wharfLines
+ where wharfCols = fmap catMaybes $ transpose wharfLines
applyMoves1 :: Wharf -> [Move] -> Wharf
applyMoves1 wharf moves = foldl' applyMove1 wharf moves