试图从这个问题中理解一个答案。我编辑了代码看起来像这样但是它只返回[]
let rec intersect a b =
let L1 = List.sort(a)
let L2 = List.sort(b)
match L1 with
|h::t -> match L2 with
|h2::t2 ->
if h=h2 then h::(intersect t t2)
else if h>h2 then intersect t L2 else intersect L1 t2
|[] -> []
|[] -> [];;
intersect [1;2;3] [2;3;4]
我需要更改什么以使其返回相交值的列表(集)?