projects
/
advent_of_code_2017.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8a72af9
)
Can't compare sequences directly
author
Ummon
<greg.burri@gmail.com>
Mon, 4 Dec 2017 07:35:44 +0000
(08:35 +0100)
committer
Ummon
<greg.burri@gmail.com>
Mon, 4 Dec 2017 07:35:44 +0000
(08:35 +0100)
AdventOfCode2017/Day4.fs
patch
|
blob
|
history
diff --git
a/AdventOfCode2017/Day4.fs
b/AdventOfCode2017/Day4.fs
index
9b73bf7
..
c71ec77
100644
(file)
--- 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 w2 = Seq.
sort w1 = Seq.sort w2
+let isAnagram w1 w2 = Seq.
compareWith (compare) (Seq.sort w1) (Seq.sort w2) = 0
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