(mac set-once (s v) `(if (no:bound ',s) (= ,s ,v))) (set-once t* (thread:asv))
And you're right, the hash-table is not needed at all. That was a premature design.
I actually re-wrote it a bit:
; watch the result of (func) for change ; and run 'on-change' when value changes (def watch-fn (func on-change) (let init (func) (while (is init (func)) (sleep 2)) (on-change))) ; watch the value-exp expression for changes ; and run on-change-exp when it changes (mac watch (value-exp on-change-exp) `(watch-fn (fn() ,value-exp) (fn() ,on-change-exp))) (def watch-file (file-name deleg) (watch (mtime file-name) (deleg file-name))) (def auto-reload (file-name) (prn "w/auto-reloading " file-name) (watch-file file-name load)) (auto-reload "web.arc")