From: Ummon Date: Mon, 4 Dec 2017 07:06:24 +0000 (+0100) Subject: Simplification X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=219bb4553646190cdc08e2405de8dd38e4b6fedf;p=advent_of_code_2017.git Simplification --- diff --git a/AdventOfCode2017/Day4.fs b/AdventOfCode2017/Day4.fs index 995715f..0d2f6f8 100644 --- a/AdventOfCode2017/Day4.fs +++ b/AdventOfCode2017/Day4.fs @@ -16,5 +16,5 @@ let isAnagram (w1 : string) (w2 : string) = let passphraseValidAnagram = forallDistinctPairs isAnagram -let nbPassphrasesValid (f : string -> bool) (pps : string seq) = - pps |> Seq.map f |> Seq.fold (fun sum valid -> if valid then sum + 1 else sum) 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