diff options
| author | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-21 20:09:00 +0100 |
|---|---|---|
| committer | Edvard Thörnros <edvard.thornros@gmail.com> | 2021-01-21 20:09:00 +0100 |
| commit | 18e7483580c000ee512f4a1f266b39c8f206ba65 (patch) | |
| tree | d4bbad1dbd1b57e39b48d2a093df32c5bcf01c75 /src/lib.rs | |
| parent | d261da01634c5fd62cd68f8c9c39a89422bdd398 (diff) | |
| download | sylt-18e7483580c000ee512f4a1f266b39c8f206ba65.tar.gz | |
Pop upvalues
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -232,6 +232,30 @@ mod tests { factorial(5) <=> 120 factorial(6) <=> 720 factorial(12) <=> 479001600", + + returning_closures: " +f : fn -> fn -> int = fn -> fn -> int { + x : int = 0 + f := fn -> int { + x = x + 1 + ret x + } + f() <=> 1 + ret f +} + +a := f() +b := f() + +a() <=> 2 +a() <=> 3 + +b() <=> 2 +b() <=> 3 + +a() <=> 4 +" + //TODO this tests doesn't terminate in proper time if we print blocks and ops /* fibonacci: "fibonacci : fn int -> int = fn n: int -> int { |
