Jane Street OCaml Challenge: Product of List
Write a recursive function to compute the product of all elements in a list.
let rec product xs =
match xs with
| [] -> failwith "For you to implement"
| _for_you_to_implement -> failwith "For you to implement"
Tests
let%test "Testing product..." = Int.equal 1 (product [])
let%test "Testing product..." = Int.equal 55 (product [ 55 ])
let%test "Testing product..." = Int.equal 25 (product [ 5; -5; 1; -1 ])
let%test "Testing product..." = Int.equal 25 (product [ 5; 5; 1; 1 ])