Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec remove((l, occ, elem):int list * int * int) =
- if occ=0 then (l,occ) else
- match l with
- |[]->([],occ)
- |[x]->if x=elem then ([],(occ-1)) else ([x],occ)
- |x::xs->
- let (p,_)=remove(xs,occ,elem)
- in
- if x=elem then remove(xs,(occ-1),elem) else (x::p,occ)
- System.Console.WriteLine(remove(([10;2;3], 2, 2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement