Question: 4. (i) Write directly by recursion a function sum_some : int option list -> int that computes the sum of all of the integers in

4. (i) Write directly by recursion a function sum_some : int option list -> int that computes the sum of all of the integers in the list. (ii) Write the same function using only fold by filling in the ... in let sum_some2 xs List.fold (fun so -> match o with .) Oxs (iii) Write the same function using map and fold by filling in the ... in let sum_some3 xs = let f o = List.fold (+) 0 (List.map f xs) 4. (i) Write directly by recursion a function sum_some : int option list -> int that computes the sum of all of the integers in the list. (ii) Write the same function using only fold by filling in the ... in let sum_some2 xs List.fold (fun so -> match o with .) Oxs (iii) Write the same function using map and fold by filling in the ... in let sum_some3 xs = let f o = List.fold (+) 0 (List.map f xs)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
