aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorEdvard Thörnros <edvard.thornros@gmail.com>2021-01-21 20:09:00 +0100
committerEdvard Thörnros <edvard.thornros@gmail.com>2021-01-21 20:09:00 +0100
commit18e7483580c000ee512f4a1f266b39c8f206ba65 (patch)
treed4bbad1dbd1b57e39b48d2a093df32c5bcf01c75 /src/lib.rs
parentd261da01634c5fd62cd68f8c9c39a89422bdd398 (diff)
downloadsylt-18e7483580c000ee512f4a1f266b39c8f206ba65.tar.gz
Pop upvalues
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 794bbea..e83d11f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {