From 95c98eccbe322e45d02a96eb2d7fde806d3d74d5 Mon Sep 17 00:00:00 2001 From: Ummon Date: Tue, 19 Dec 2017 12:08:10 +0100 Subject: [PATCH] Simplify --- AdventOfCode2017/Day19.fs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/AdventOfCode2017/Day19.fs b/AdventOfCode2017/Day19.fs index 2b14c2e..668c09c 100644 --- a/AdventOfCode2017/Day19.fs +++ b/AdventOfCode2017/Day19.fs @@ -3,7 +3,6 @@ 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'] @@ -13,10 +12,10 @@ let followThePath (lines : string[]) : string * int = |> List.pick ( fun (ndi, ndj) -> let ni, nj = i' + ndi, j' + ndj - if (ni, nj) <> (i, j) && isNotWhiteSpace lines.[ni].[nj] then Some (ndi, ndj) else None + if (ni, nj) <> (i, j) && lines.[ni].[nj] <> ' ' then Some (ndi, ndj) else None ) next (i', j') nextDir str (n + 1) - elif isNotWhiteSpace c then + elif c <> ' ' then next (i', j') (di, dj) (if Char.IsLetter c then str + string c else str) (n + 1) else str, n -- 2.45.2