summaryrefslogtreecommitdiff
path: root/tests/stack-test.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stack-test.lisp')
-rw-r--r--tests/stack-test.lisp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/stack-test.lisp b/tests/stack-test.lisp
new file mode 100644
index 0000000..cabbaa3
--- /dev/null
+++ b/tests/stack-test.lisp
@@ -0,0 +1,18 @@
+(define g (x) (+ x 1))
+
+(define f (x)
+ (if (<= x 0)
+ 0
+ (let ((y (g x)))
+ (+ y (f (/ x 2))))))
+
+; f 10
+; = 11 + f 5
+; = 11 + 6 + f 2
+; = 11 + 6 + 3 + f 1
+; = 11 + 6 + 3 + 2
+; = 22
+(print (f 10))
+
+; Without Stackify, the deepest y value, i.e. 2, overwrites all y values above,
+; resulting in 2 + 2 + 2 + 2 = 8.