Sum at K
Implement the function
val sum_at_k : int list -> int -> int
so that sum_at_k l k is the result of adding together every \(k\)th
element of l, starting from the 0-th element. The behavior of the
function is undefined if k is not positive. Your implementation
must be tail recursive.
Examples
let _ = assert (sum_at_k [1;2;3;4;5] 2 = 1 + 3 + 5) let _ = assert (sum_at_k [1;2;3;4;5] 1 = 1 + 2 + 3 + 4 + 5) let _ = assert (sum_at_k [1;2;3;4;5] 10 = 1)