From b6083bec859679d01795c10df1e1211deff9bf7c Mon Sep 17 00:00:00 2001 From: Ummon Date: Tue, 19 Dec 2017 09:46:11 +0100 Subject: [PATCH] Cleaning --- AdventOfCode2017/Day19.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AdventOfCode2017/Day19.fs b/AdventOfCode2017/Day19.fs index bb10ce5..281bd64 100644 --- a/AdventOfCode2017/Day19.fs +++ b/AdventOfCode2017/Day19.fs @@ -3,18 +3,18 @@ open System let followThePath (lines : string[]) : string * int = - let rec next (i, j) (di, dj) (str : string) (n : int) = + let rec next (i, j) (di, dj) str n = let i', j' = i + di, j + dj let c = lines.[i'].[j'] if c = '+' then - let pos = + let nextDir = [ '-', 0, 1; '|', -1, 0; '-', 0, -1; '|', 1, 0 ] |> List.pick ( fun (c', ndi, ndj) -> let ni, nj = i' + ndi, j' + ndj if (ni, nj) <> (i, j) && (Char.IsLetter lines.[ni].[nj] || lines.[ni].[nj] = c') then Some (ndi, ndj) else None ) - next (i', j') pos str (n + 1) + next (i', j') nextDir str (n + 1) elif Char.IsWhiteSpace c |> not then next (i', j') (di, dj) (if Char.IsLetter c then str + string c else str) (n + 1) else -- 2.45.2