mirror of
https://github.com/anoma/juvix.git
synced 2024-12-12 14:28:08 +03:00
7 lines
172 B
Plaintext
7 lines
172 B
Plaintext
|
-- tail recursion
|
||
|
|
||
|
def sum' : Int -> Int -> Int := \(x : Int) \(acc : Int) if x = 0 then acc else sum' (x - 1) (x + acc);
|
||
|
def sum : Int -> Int := \(x : Int) sum' x 0;
|
||
|
|
||
|
sum
|