Task

Take a   Natural Number   in a given base and return the sum of its digits:

   110         sums to   1
   123410   sums to   10
   fe16       sums to   29
   f0e16     sums to   29


get "libhdr"
 
let digitsum(n, base) =
    n=0 -> 0,
    n rem base + digitsum(n/base, base)
 
let start() be 
$(  writef("%N*N", digitsum(1, 10))      // prints 1
    writef("%N*N", digitsum(1234, 10))   // prints 10
    writef("%N*N", digitsum(#1234, 8))   // also prints 10
    writef("%N*N", digitsum(#XFE, 16))   // prints 29
    writef("%N*N", digitsum(#XF0E, 16))  // also prints 29
$)