Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Add missing day marker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mulling committed Dec 13, 2023
1 parent fff31b9 commit 8e3d592
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion content/aoc/aoc-2023-mulling.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ draft: false
- [Day 2](#day-2)
- [Day 3](#day-3)
- [Day 4](#day-4)
- [Day 5](#day-5)

## Day 1
This problem kinda stinks, plus I'm still very rusty with the ol' Haskell.
Expand Down Expand Up @@ -146,7 +147,22 @@ import Control.Applicative
import Data.Set qualified as S

main :: IO ()
main = interact (show . sum . map ((2 ^) . pred) . filter (> 0) . (S.size . liftA2 S.intersection head last . (S.fromList . ((\xs -> read xs :: Int) <$>) . words <$>) . split (== '|') . tail . dropWhile (/= ':') <$>) . lines)
main =
interact
( show
. sum
. map ((2 ^) . pred)
. filter (> 0)
. ( S.size
. liftA2 S.intersection head last
. (S.fromList . ((\xs -> read xs :: Int) <$>) . words <$>)
. split (== '|')
. tail
. dropWhile (/= ':')
<$>
)
. lines
)
where
split fn xs = case break fn xs of
(a, _ : b) -> a : split fn b
Expand Down

0 comments on commit 8e3d592

Please sign in to comment.