From d7cbab174852e3190a5976bf518adf2282e6e55e Mon Sep 17 00:00:00 2001 From: Ummon Date: Mon, 4 Dec 2017 08:09:46 +0100 Subject: [PATCH] Improve conciseness... --- AdventOfCode2017/Day4.fs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/AdventOfCode2017/Day4.fs b/AdventOfCode2017/Day4.fs index 0d2f6f8..87ad47e 100644 --- a/AdventOfCode2017/Day4.fs +++ b/AdventOfCode2017/Day4.fs @@ -1,7 +1,5 @@ module AdventOfCode2017.Day4 -open System - let forallDistinctPairs (f : string -> string -> bool) (pp : string) = let words = pp.Split ' ' [ @@ -10,11 +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 : string) (w2 : string) = (w1.ToCharArray () |> Array.sort) = (w2.ToCharArray () |> Array.sort) 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 +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