From 541279fa25890fe8bd7765cec80a68595d77426b Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 4 Dec 2020 10:31:44 -0600 Subject: [PATCH] Use sets difference in operator-style --- 2020/src/day4.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2020/src/day4.nim b/2020/src/day4.nim index 81330d5..ec45a33 100644 --- a/2020/src/day4.nim +++ b/2020/src/day4.nim @@ -18,7 +18,7 @@ proc parsePassports(s: Stream): seq[Table[string, string]] = .filterIt(it != "").mapIt(it.split(':', 2)).mapIt((it[0], it[1])).toTable) proc hasRequiredFields(p: Table[string, string]): bool = - toSeq(validators.keys).toHashSet.difference(["cid"].toHashSet) <= toSeq(p.keys).toHashSet + (toSeq(validators.keys).toHashSet - ["cid"].toHashSet) <= toSeq(p.keys).toHashSet proc part1*(s: Stream): int = s.parsePassports.countIt(it.hasRequiredFields)