aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/src/day7
diff options
context:
space:
mode:
authorHunky Jimpjorps <thechairman@thechairman.info>2023-12-08 09:42:11 -0500
committerHunky Jimpjorps <thechairman@thechairman.info>2023-12-08 09:42:11 -0500
commit82c3ecec3de5111b460910bafe141b3aed478676 (patch)
tree98e1cb821151cea989608b3f55e8a8642fab3da0 /aoc2023/src/day7
parentc82dee4b12a824ff73dc91f89445d4df75d3c876 (diff)
downloadgleam_aoc-82c3ecec3de5111b460910bafe141b3aed478676.tar.gz
gleam_aoc-82c3ecec3de5111b460910bafe141b3aed478676.zip
updated for new exhaustiveness checks in 0.33
Diffstat (limited to 'aoc2023/src/day7')
-rw-r--r--aoc2023/src/day7/solve.gleam8
1 files changed, 4 insertions, 4 deletions
diff --git a/aoc2023/src/day7/solve.gleam b/aoc2023/src/day7/solve.gleam
index 08740f6..4454883 100644
--- a/aoc2023/src/day7/solve.gleam
+++ b/aoc2023/src/day7/solve.gleam
@@ -16,7 +16,7 @@ type Hand {
// Common functions --------------------------------------------------------------------------------
fn parse_hand(str: String) -> Hand {
- let [cards, wager] = string.split(str, " ")
+ let assert [cards, wager] = string.split(str, " ")
let cards =
string.to_graphemes(cards)
|> list.map(card_rank)
@@ -54,7 +54,7 @@ fn card_rank(card: String) -> Int {
_, "Q" -> 12
_, "J" -> 11
_, "T" -> 10
- _, "*" -> 1
+ _, _ -> 1
}
}
@@ -67,8 +67,8 @@ fn compare_hands(hand1: Hand, hand2: Hand, using: fn(Hand) -> Int) -> Order {
fn compare_top_card(cards1: List(Int), cards2: List(Int)) -> Order {
use <- bool.guard(cards1 == [] || cards2 == [], Eq)
- let [c1, ..rest1] = cards1
- let [c2, ..rest2] = cards2
+ let assert [c1, ..rest1] = cards1
+ let assert [c2, ..rest2] = cards2
case int.compare(c1, c2) {
Eq -> compare_top_card(rest1, rest2)
other -> other