summaryrefslogtreecommitdiff
path: root/tests/clos4.bth
diff options
context:
space:
mode:
Diffstat (limited to 'tests/clos4.bth')
-rw-r--r--tests/clos4.bth29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/clos4.bth b/tests/clos4.bth
new file mode 100644
index 0000000..c9a2092
--- /dev/null
+++ b/tests/clos4.bth
@@ -0,0 +1,29 @@
+(defn (f)
+ (let (a 0)
+ (defn (s x) (set a x))
+ (defn (g) a)
+ [s g]))
+
+
+(def a1 (f))
+(def s1 (a1 0))
+(def g1 (a1 1))
+
+(def a2 (f))
+(def s2 (a2 0))
+(def g2 (a2 1))
+
+(say (g1))
+(say (g2))
+
+(s1 6)
+(say (g1))
+(say (g2))
+
+(s2 70)
+(say (g1))
+(say (g2))
+
+(s2 (* (g1) (g1)))
+(say (g1))
+(say (g2))