Untitled

Run Settings
LanguageF#
Language Version
Run Command
type xlist = | A | B of int * xlist let rec exclude (n: int ) = function (* list is empty *) | A -> A (* one value only, located in head, and it=n *) // | B(head, A) when head = n -> A (* one value only, located in head, and it<>n *) // | B(head, A) when head <> n -> B(head, A) (* n is either 1st or 2nd *) | B(v1, rest) -> if v1 = n then exclude n rest else B(v1, exclude n rest) let list0 = A let list1 = B(1, A) let list2 = B(2, list1) let list3 = B(3, list2) let list4 = B(3, list3) let exec n list = printfn "Before: %A" list printfn "exclude: %A" n exclude n list |> printfn "After: %A" printfn "---------------" exec 1 list0 exec 1 list1 exec 1 list2 exec 1 list3 exec 2 list3 exec 3 list4
Editor Settings
Theme
Key bindings
Full width
Lines