From a5750e7b0ea2459842e74008aa130d7564be2cbd Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Tue, 12 Dec 2017 06:37:07 +0100 Subject: [PATCH] Cleaning --- AdventOfCode2017/Day12.fs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AdventOfCode2017/Day12.fs b/AdventOfCode2017/Day12.fs index 0a61c9b..8d840f1 100644 --- a/AdventOfCode2017/Day12.fs +++ b/AdventOfCode2017/Day12.fs @@ -13,11 +13,11 @@ type Graph = let parseInput (lines : string[]) : (Graph * string[]) list = [ for line in lines do - let a = line.Split ([| ' '; ',' |], StringSplitOptions.RemoveEmptyEntries) - yield { Name = a.[0]; Neighbors = List () }, a.[2 .. a.Length - 1] + let splitLine = line.Split ([| ' '; ',' |], StringSplitOptions.RemoveEmptyEntries) + yield { Name = splitLine.[0]; Neighbors = List () }, splitLine.[2 .. splitLine.Length - 1] ] -let f (input : (Graph * string[]) list) = +let graphCount (input : (Graph * string[]) list) = let toVisit = Dictionary () for g, names in input do @@ -28,7 +28,7 @@ let f (input : (Graph * string[]) list) = g'.Neighbors.Add (g) g.Neighbors.Add (g') - let visited = List> () + let visitedGroups = List> () let rec visit (g : Graph) (dic : Dictionary) = if dic.ContainsKey g.Name |> not then @@ -39,8 +39,8 @@ let f (input : (Graph * string[]) list) = while toVisit.Count > 0 do let dic = Dictionary () - visited.Add dic + visitedGroups.Add dic visit (toVisit.First().Value) dic - visited.First().Count, visited.Count + visitedGroups.First().Count, visitedGroups.Count -- 2.45.2