From 8a72af978e9a64988c6503bffd02082b3d045eca Mon Sep 17 00:00:00 2001 From: Ummon Date: Mon, 4 Dec 2017 08:23:12 +0100 Subject: [PATCH] Improve conciseness.... --- AdventOfCode2017/Day4.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdventOfCode2017/Day4.fs b/AdventOfCode2017/Day4.fs index 87ad47e..9b73bf7 100644 --- a/AdventOfCode2017/Day4.fs +++ b/AdventOfCode2017/Day4.fs @@ -8,6 +8,6 @@ let forallDistinctPairs (f : string -> string -> bool) (pp : string) = ] |> List.forall not let passphraseValid = forallDistinctPairs (=) -let isAnagram (w1 : string) (w2 : string) = (w1.ToCharArray () |> Array.sort) = (w2.ToCharArray () |> Array.sort) +let isAnagram w1 w2 = Seq.sort w1 = Seq.sort w2 let passphraseValidAnagram = forallDistinctPairs isAnagram let nbPassphrasesValid (f : string -> bool) = Seq.map f >> Seq.sumBy (fun v -> if v then 1 else 0) \ No newline at end of file -- 2.45.2