There are two lists of dates (no assumptions can be made regarding list order)
//first list
[date_a; date_b; date_c]
//second list
[date_A; date_B; date_C]
I am looking for a function that returns the following as a list of entries: the date is unique key (a single date will appear only once in the list)
-> (date, true, true) in case both lists contained the date
-> (date, true, false) in case the first list contained the date
-> (date, false, true) in case the second list contained the date
(there will be no (date, false, false) entries)
let showMembership l1 l2 =
let s1 = Set.ofList l1
let s2 = Set.ofList l2
Set.union s1 s2
|> Set.map (fun d -> (d, Set.contains d s1, Set.contains d s2))
Note this returns a Set but you can use List.ofSeq
to create a list if required
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With