filtering sequences

83 views Asked by At

There are three different seq of same size

a:int   = {1,  2,  3,  4}
b:string= {"a","b","a","d"}
c:string= {"y","y","t","t"}

how can I create a new seq from seq:a with condition

where b="a" and c="y"
2

There are 2 answers

0
Søren Debois On BEST ANSWER
Seq.zip a (Seq.zip b c)
|> Seq.filter (snd >> ((=) ("a", "y")))
|> Seq.map fst
0
Sehnsucht On
Seq.zip3 a b c
|> Seq.choose (function (n, "a", "y") -> Some n | _ -> None)