From 22423f6cf6d79ad839b8ed081d160486094891e4 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Mon, 9 Dec 2024 02:27:33 -0500 Subject: [PATCH] refactor: `Data.Vect.range` -> `Data.List.allFins` --- src/Day4/Part1.idr | 5 +++-- src/Day6/Part2.idr | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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