aboutsummaryrefslogtreecommitdiff
path: root/tests/stepA_more.mal
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-14 22:46:54 -0500
committerJoel Martin <github@martintribe.org>2014-04-14 22:46:54 -0500
commit0027e8fed423a24ec93234a6bf0fb701c233d583 (patch)
treec1c447a16958fc174f15af15c181b1582506d9ed /tests/stepA_more.mal
parent8adb082743f12402d0817018ab1e8ff0c0e4729e (diff)
downloadmal-0027e8fed423a24ec93234a6bf0fb701c233d583.tar.gz
mal-0027e8fed423a24ec93234a6bf0fb701c233d583.zip
PS: fix function closures. Self-hosted up to step7.
Diffstat (limited to 'tests/stepA_more.mal')
-rw-r--r--tests/stepA_more.mal15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/stepA_more.mal b/tests/stepA_more.mal
index f6b01f5..892b592 100644
--- a/tests/stepA_more.mal
+++ b/tests/stepA_more.mal
@@ -117,6 +117,9 @@
(map? [])
;=>false
+(get nil "a")
+;=>nil
+
(get hm1 "a")
;=>nil
@@ -174,6 +177,9 @@
(meta (fn* (a) a))
;=>nil
+(meta +)
+;=>nil
+
(with-meta [1 2 3] {"a" 1})
;=>[1 2 3]
@@ -276,6 +282,15 @@
(swap! a + 3)
;=>123
+;; Testing swap!/closure interaction
+(def! inc-it (fn* (a) (+ 1 a)))
+(def! atm (atom 7))
+(def! f (fn* [] (swap! atm inc-it)))
+(f)
+;=>8
+(f)
+;=>9
+
;;
;; Testing read-str and eval
(read-string "(1 2 (3 4) nil)")