F# linq - How to filter for only unique values?
my seq linq is
<@ db.Dictionaries
|> Seq.filter(fun x -> x.ID_Line = l1 || x.ID_Line = l2) @>
|> fun pquery ->
<@ seq { for cd in db.DeltaCompares do
for cl1 in %pquery do
for cl2 in %pquery do
yield
if cd.IID1 = cl1.IID && cd.IID2 = cl2.IID then
开发者_高级运维 Some(cl1, cl2)
else None } @>
|> query |> Seq.choose id
|> Seq.collect(fun a -> [fst a; snd a])
|> List.ofSeq
but here I need only unique values here...
Seq.distinct
, or Seq.distinctBy
will do what you want.
Presumably the query function can handle them, if you use it inside the quotation - but don't quote me on that.
精彩评论