- let a =
let x = 20 in
let y =
let x = 5 in
x + x
in
x + y
;;
- let b =
let x = "ab" in
let y = (let x = "cd" in x) ^ x in
x ^ y
;;
- let c =
let x = 22 in
x::y
;;
Problem 2:
In each part below you are required to complete the implementation of a
function by filling in the appropriate expressions in the blanks (parts marked
...
).
let everyOther l =
let rec helper (b,l) =
match l with
[] -> ...
| h::t -> if b then ... else ...
in
helper (true,l)
;;
let rec zip (l1,l2) =
match (l1,l2) with
([],_) -> ...
| (_,[]) -> ...
| (h1::t1,h2::t2) -> (...) :: (...)
let rec unzip l =
match l with
(...) -> ([],[])
| (...) ->
let ... = ... in
((...)::(...),(...)::(...))
;;