Testing/playing
This commit is contained in:
parent
3b5e91c1bb
commit
5a72125d1f
|
@ -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 ())
|
||||||
|
|
||||||
")
|
")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user