diff options
author | ubq323 <ubq323@ubq323.website> | 2024-07-03 12:01:22 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2024-07-03 12:06:42 +0100 |
commit | d8d3770f88d6acc37620d6577fa5a0b026fb1231 (patch) | |
tree | 65808bc58319a3002b6690b1811ab02fbf4ddc2d /tests/clos4.bth | |
parent | 9f4e10da9df486b4c048ec2fedbe28491059b739 (diff) |
add some failing tests for closures
Diffstat (limited to 'tests/clos4.bth')
-rw-r--r-- | tests/clos4.bth | 29 |
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)) |