Consider:
type Nat
= Zero
| Succ Nat
nat : Int -> Nat
nat n =
nat_ n Zero
nat_ : Int -> Nat -> Nat
nat_ n curr =
if n <= 0 then
curr
else
nat_ (n - 1) (Succ curr)
Using tail recursion, this should be stack safe in Elm (as far as I
understand). But I get a stack overflow for large values of n (>= 5000). Is
my function really tail recursive, or might there be a bug in Elm?
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.