【发布时间】:2016-01-30 04:02:10
【问题描述】:
let rec isolate (l:'a list) =
match l with
| [] -> []
| x::xs ->
if memberof(x,xs)
then remove (x,l)
else isolate xs
我已经创建了 memberof 和 remove 函数,唯一的问题是当第 6 行 remove(x,l) 执行时,它不会继续使用 isolate(xs) 继续搜索列表。
有没有办法说,
if x then f(x) and f(y)
?
【问题讨论】:
-
您是否尝试使用递归实现
List.distinct? -
是的,我相信这就是我想要写的递归函数。
-
您的问题已经解决了吗?
标签: list recursion f# tail-recursion