Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 57ec7e1

Browse files
committed
less gratuitious lens
1 parent b8d7ef8 commit 57ec7e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/AOC2017/Day23.hs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module AOC2017.Day23 (day23a, day23b, parse) where
33
import AOC2017.Types (Challenge)
44
import AOC2017.Util.Tape (Tape(..), HasTape(..), unsafeTape, move)
55
import Control.Applicative (many)
6-
import Control.Lens (set, view, use, at, non, _last, forMOf_, Iso', iso)
6+
import Control.Lens (set, use, at, non, _last, forMOf_, Iso', iso)
77
import Control.Lens.Operators ((.=), (%=))
88
import Control.Lens.TH (makeClassy, makePrisms)
99
import Control.Lens.Tuple (_1, _2, _3)
@@ -47,7 +47,7 @@ parse = map parseOp . lines
4747

4848
-- | Replaces the two inner oops with a simple prime check
4949
optimize :: [Op] -> [Op]
50-
optimize = set (_last . _OJmp . _3) (-7)
50+
optimize = set (_last . _OJmp . _3) (-7)
5151
. set (splot 8 . _2 . splot 17 . _1) [parseOp "jpm b 2"]
5252
where
5353
-- split by prefix and suffx
@@ -95,7 +95,7 @@ day23a = show . getSum . snd
9595
. parse
9696

9797
day23b :: Challenge
98-
day23b = show . view (_1 . _2 . psRegs . at 'h'. non 0)
98+
day23b = show . M.findWithDefault 0'h'. _psRegs . snd.fst
9999
. runTapeProg (many stepTape)
100100
. (`PS` M.singleton 'a' 1) . unsafeTape
101101
. optimize . parse

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /