function res = sumaccum(vec) %! Wrapper function
res = helper(vec,0); 
%!! Initialize the accumulator to 0
%%%%%%%%%%%
function res = helper(vec,accum) %! Helper subfunction
if isempty(vec)
   res = accum; %! Done. Return accumulator.
else
   %!! Update the accumulator 
   res = helper(vec(2:end), accum+vec(1));
   %!! and recurse.
end
