aboutsummaryrefslogtreecommitdiff
path: root/aoc-2022-dotnet/Common/Util.fs
diff options
context:
space:
mode:
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 ]