translation of recursion exercises