diff --git a/src/Day4/Part1.idr b/src/Day4/Part1.idr index eb2a57f..19066b2 100644 --- a/src/Day4/Part1.idr +++ b/src/Day4/Part1.idr @@ -1,5 +1,6 @@ module Day4.Part1 +import Data.List import Data.String import Data.Vect @@ -59,8 +60,8 @@ checkString board str = go (unpack str) export findChar : {h, w : _} -> Board h w -> Char -> List (Pos h w) findChar board c = do - i <- toList $ range {len=h} - j <- toList $ range {len=w} + i <- allFins h + j <- allFins w guard (index (i, j) board == c) pure (i, j) diff --git a/src/Day6/Part2.idr b/src/Day6/Part2.idr index 58f09d9..6f25782 100644 --- a/src/Day6/Part2.idr +++ b/src/Day6/Part2.idr @@ -38,8 +38,8 @@ covering loopPos : {h, w : _} -> (Pos h w, Direction) -> Map h w -> List (Pos h w) loopPos g mp = do - i <- toList $ range {len=h} - j <- toList $ range {len=w} + i <- allFins h + j <- allFins w let obs = (i,j) guard (obs /= fst g && not (index obs mp)) -- must be empty space let cols = getCollisions g $ insertObs obs mp