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)) (println (ex-message e))
(pp/pprint (ex-data e))))) (pp/pprint (ex-data e)))))
(do (comment
(def source " (def source "
let foo = { fn swap! (rf, f) -> {
let x = :f00 let val = deref (rf)
let new = f (val)
fn foo () -> x 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 ())
") ")