From: Ummon Date: Wed, 13 Dec 2017 08:20:27 +0000 (+0100) Subject: cleaning X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=d65adbfd27de5c53fe60d26a3a52739a46570715;p=advent_of_code_2017.git cleaning --- diff --git a/AdventOfCode2017/Day13.fs b/AdventOfCode2017/Day13.fs index 127d18f..d1b1b2a 100644 --- a/AdventOfCode2017/Day13.fs +++ b/AdventOfCode2017/Day13.fs @@ -11,7 +11,7 @@ let parseInput (lines : string[]) = ) let severity (input : (int * int)[]) : int * int = - let severity (f : int -> int -> int) delay = + let inline sumByF (f : int -> int -> int) delay = input |> Array.sumBy (fun (depth, range) -> if (depth + delay) % (2 * range - 2) = 0 then f depth range else 0) - severity (*) 0, Seq.initInfinite (fun i -> i, severity (+) i) |> Seq.pick (fun (i, s) -> if s = 0 then Some i else None) \ No newline at end of file + sumByF (*) 0, Seq.initInfinite (fun i -> i, sumByF (+) i) |> Seq.pick (fun (i, s) -> if s = 0 then Some i else None) \ No newline at end of file