Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> func pow(uint base, uint n): n == 0 ? return 1 : return n * pow(base, n-1)

Nitpick: that’s not tail recursive. Something like def pow(base, n, acc=1) = match n case 0 => acc; default => pow(base, n-1, acc*base)



Given that `base` is never used, I suspect that's not the only issue :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: