aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common/Util.fs
diff options
context:
space:
mode:
authorTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-30 14:35:09 +0100
committerTomasz Chojnacki <tomaszchojnacki2001@gmail.com>2022-12-30 14:35:09 +0100
commit353d185a1f89654f999dca7b75016ebef461a23c (patch)
tree24acbc0bd35385312a563263ce3b665d49a5ffe9 /aoc-2022-dotnet/Common/Util.fs
parent62a2e6fb7175f683a4d315374efd5bc4ea331dc5 (diff)
downloadgleam_aoc2020-353d185a1f89654f999dca7b75016ebef461a23c.tar.gz
gleam_aoc2020-353d185a1f89654f999dca7b75016ebef461a23c.zip
Finish day 24
Diffstat (limited to 'aoc-2022-dotnet/Common/Util.fs')
-rw-r--r--aoc-2022-dotnet/Common/Util.fs4
1 files changed, 4 insertions, 0 deletions
diff --git a/aoc-2022-dotnet/Common/Util.fs b/aoc-2022-dotnet/Common/Util.fs
index ac5d981..ad177db 100644
--- a/aoc-2022-dotnet/Common/Util.fs
+++ b/aoc-2022-dotnet/Common/Util.fs
@@ -4,6 +4,7 @@ module Util =
open System.Globalization
open FParsec
open FSharpPlus
+ open FSharpPlus.Math.Generic
let parse parser input =
match run parser input with
@@ -16,6 +17,9 @@ module Util =
let charToInt = CharUnicodeInfo.GetDigitValue
+ let wrapInRangeInc lower upper x =
+ lower + remE (x - lower) (upper - lower + 1)
+
let cutInHalf xs =
let half = Seq.length xs / 2
[ Seq.take half xs; Seq.skip half xs ]