aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Day08/Program.fs
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-09 19:31:24 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-09 19:31:24 +0100
commit967e964f453fc031816270b90d6eab38410769a3 (patch)
tree99ca5504c1be629eb35cda6514df401965d232fd /aoc-2022-dotnet/Day08/Program.fs
parentfd04f2ebd1a4ade35a3e218b7737311ac631fce8 (diff)
downloadgleam_aoc2020-967e964f453fc031816270b90d6eab38410769a3.tar.gz
gleam_aoc2020-967e964f453fc031816270b90d6eab38410769a3.zip
Extract common functions to util module
Diffstat (limited to 'aoc-2022-dotnet/Day08/Program.fs')
-rw-r--r--aoc-2022-dotnet/Day08/Program.fs9
1 files changed, 3 insertions, 6 deletions
diff --git a/aoc-2022-dotnet/Day08/Program.fs b/aoc-2022-dotnet/Day08/Program.fs
index 1a98c6d..23f93c0 100644
--- a/aoc-2022-dotnet/Day08/Program.fs
+++ b/aoc-2022-dotnet/Day08/Program.fs
@@ -1,11 +1,9 @@
module Day08
open System.IO
-open System.Globalization
+open Common
-let parseMatrix =
- array2D
- >> Array2D.map CharUnicodeInfo.GetDigitValue
+let parseMatrix = array2D >> Array2D.map Util.charToInt
let mapEachToSeq mapping m =
seq {
@@ -35,8 +33,7 @@ let scenicScore (m: 'a [,]) r c =
let solution1 =
parseMatrix
>> mapEachToSeq isVisible
- >> Seq.filter id
- >> Seq.length
+ >> Util.countWhere id
let solution2 = parseMatrix >> mapEachToSeq scenicScore >> Seq.max