Testing/playing

This commit is contained in:
Scott Richmond 2022-05-18 20:30:27 -04:00
parent 3b5e91c1bb
commit 5a72125d1f

View File

@ -401,17 +401,37 @@
(println (ex-message e))
(pp/pprint (ex-data e)))))
(do
(comment
(def source "
let foo = {
let x = :f00
fn foo () -> x
fn swap! (rf, f) -> {
let val = deref (rf)
let new = f (val)
set! (rf, new)
}
foo ()
let counter = {
ref i = 0
fn next () -> {
let n = deref (i)
if eq (n, 3)
then (:done, nil)
else {
swap! (i, inc)
(:value, n)
}
}
@{next}
}
print (counter :next ())
print (counter :next ())
print (counter :next ())
print (counter :next ())
print (counter :next ())
")