From 5746dbca0ddaef455b6f26fba3945f3533d0b2c1 Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Wed, 22 Feb 2023 13:34:58 +0100 Subject: Add aliases to long imports --- aoc-2020-gleam/src/days/day05.gleam | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'aoc-2020-gleam/src/days/day05.gleam') diff --git a/aoc-2020-gleam/src/days/day05.gleam b/aoc-2020-gleam/src/days/day05.gleam index f655be9..b1471f9 100644 --- a/aoc-2020-gleam/src/days/day05.gleam +++ b/aoc-2020-gleam/src/days/day05.gleam @@ -1,31 +1,31 @@ import gleam/io import gleam/int -import gleam/string import gleam/list import gleam/set +import gleam/string as str import gleam/iterator as iter -import ext/resultx +import ext/resultx as resx import util/input_util fn get_seat_id(pass: String) -> Int { pass - |> string.to_graphemes + |> str.to_graphemes |> list.map(with: fn(grapheme) { case grapheme { "F" | "L" -> "0" "B" | "R" -> "1" } }) - |> string.concat + |> str.concat |> int.base_parse(2) - |> resultx.force_unwrap + |> resx.assert_unwrap } fn part1(lines: List(String)) -> Int { lines |> list.map(with: get_seat_id) |> list.reduce(with: int.max) - |> resultx.force_unwrap + |> resx.assert_unwrap } fn part2(lines: List(String)) -> Int { @@ -40,7 +40,7 @@ fn part2(lines: List(String)) -> Int { in: iter.range(from: 1, to: 1023), one_that: fn(id) { occupied(id - 1) && !occupied(id) && occupied(id + 1) }, ) - |> resultx.force_unwrap + |> resx.assert_unwrap } pub fn run() -> Nil { -- cgit v1.2.3