[back]

Product Above K

Implement the function

val prod_above_k : int list -> int -> int

so that prod_above_k l k is the result of multiplying together the elements of the list l whose index is larger than k. If no elements of l have an index larger than k, the result is 1. Your implementation must be tail recursive.

Examples

let _ = assert (prod_above_k [1;5;2;3;4;6;7] 3 = 4 * 6 * 7)
let _ = assert (prod_above_k [1;2;3] 10 = 1)
let _ = assert (prod_above_k [1;2;3] (-1) = 1 * 2 * 3)