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/day03.gleam | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'aoc-2020-gleam/src/days/day03.gleam') diff --git a/aoc-2020-gleam/src/days/day03.gleam b/aoc-2020-gleam/src/days/day03.gleam index da67658..6f256bf 100644 --- a/aoc-2020-gleam/src/days/day03.gleam +++ b/aoc-2020-gleam/src/days/day03.gleam @@ -1,11 +1,11 @@ -import gleam/string import gleam/list -import gleam/function import gleam/io -import gleam/iterator as iter import gleam/int +import gleam/string as str +import gleam/function as fun +import gleam/iterator as iter import gleam/set.{Set} -import ext/resultx +import ext/resultx as resx import ext/iteratorx as iterx import util/input_util @@ -27,7 +27,7 @@ type Area { } fn parse_area(from text: String) -> Area { - let lines = string.split(text, on: "\n") + let lines = str.split(text, on: "\n") let trees = list.index_fold( @@ -35,14 +35,14 @@ fn parse_area(from text: String) -> Area { from: set.new(), with: fn(prev, line, y) { line - |> string.to_graphemes + |> str.to_graphemes |> list.index_map(with: fn(x, grapheme) { case grapheme { "#" -> Ok(#(x, y)) _ -> Error(Nil) } }) - |> list.filter_map(with: function.identity) + |> list.filter_map(with: fun.identity) |> set.from_list |> set.union(prev) }, @@ -50,8 +50,8 @@ fn parse_area(from text: String) -> Area { let cycle = lines |> list.first - |> resultx.force_unwrap - |> string.length + |> resx.assert_unwrap + |> str.length let height = list.length(lines) Area(trees, cycle, height) -- cgit v1.2.3