预期的结果将是数字索引
1
2
返回结果索引应为let
。 如果答案避免使用序列操作员和循环,那将是很棒的。
没有sequence op op
;
,
for
,while
class c = object (self)
method f i = function
| x::_ when x <> 0 -> i
| _::xs -> self#f (i+1) xs
| [] -> failwith "Got the answer from StackOverflow"
end
;;
(new c)#f 0 [0;0;1;2;0;4;5;6];;