by flakes · 2y ago · 0 comments
func isOdd(n int) bool {
switch {
case n == 0:
return false
case n > 0:
return !isOdd(n-1)
default:
return !isOdd(n+1)
}
} let rec isEven n =
if n = 0 then true
else isOdd (n-1)
and isOdd n =
not (isEven n)You may need to call setrlimit with an appropriate RLIMIT_STACK, but I think the FFI compatibility should be able to pull that off, right?
Doesn't Go allocate / extend stacks using dynamic allocation rather than having a static limit (e.g. like C)?