Last active
December 12, 2015 02:18
-
-
Save vasily-kirichenko/4697027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sortedKeyList = | |
Seq.map (Map.toSeq >> Seq.map fst) | |
>> Seq.concat | |
>> Seq.distinct | |
>> Seq.sort | |
>> String.concat ", " | |
>> (function "" -> "<none>" | s -> s) | |
[<Fact>] | |
let ``Sorted key list``() = | |
[[], [], "<none>" | |
["fred", true], ["barney", true; "wilma", true], "barney, fred, wilma" | |
["fred", true], [], "fred" | |
["fred", true], ["fred", true; "barney", true], "barney, fred"] | |
|> List.iter (fun (m1, m2, res) -> sortedKeyList [Map.ofSeq m1; Map.ofSeq m2] =? res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment