From: Ummon Date: Tue, 19 Dec 2017 09:18:23 +0000 (+0100) Subject: Cleaning X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=ea808fb13efe0cd371f4a66b9ab406b828e6d243;p=advent_of_code_2017.git Cleaning --- diff --git a/AdventOfCode2017/Day19.fs b/AdventOfCode2017/Day19.fs index 04d98c8..2b14c2e 100644 --- a/AdventOfCode2017/Day19.fs +++ b/AdventOfCode2017/Day19.fs @@ -3,6 +3,7 @@ open System let followThePath (lines : string[]) : string * int = + let isNotWhiteSpace = Char.IsWhiteSpace >> not let rec next (i, j) (di, dj) str n = let i', j' = i + di, j + dj let c = lines.[i'].[j'] @@ -12,10 +13,10 @@ let followThePath (lines : string[]) : string * int = |> List.pick ( fun (ndi, ndj) -> let ni, nj = i' + ndi, j' + ndj - if (ni, nj) <> (i, j) && (Char.IsWhiteSpace lines.[ni].[nj] |> not) then Some (ndi, ndj) else None + if (ni, nj) <> (i, j) && isNotWhiteSpace lines.[ni].[nj] then Some (ndi, ndj) else None ) next (i', j') nextDir str (n + 1) - elif Char.IsWhiteSpace c |> not then + elif isNotWhiteSpace c then next (i', j') (di, dj) (if Char.IsLetter c then str + string c else str) (n + 1) else str, n