Adding atom tests and makefile

This commit is contained in:
teo3300
2024-06-17 01:02:27 +09:00
parent 1f20079571
commit fb2aabbcef
2 changed files with 26 additions and 0 deletions

View File

@ -4,3 +4,16 @@
; deref
(assert-eq (deref (atom 1)) 1)
; @ macro
(assert-eq @(atom 1) 1)
(def! ATOM (atom 1))
; reset!
(reset! ATOM 2)
(assert-eq @ATOM 2)
; swap!
(swap! ATOM (fn* [x] (* x 2)))
(assert-eq @ATOM 4)