From c2a872681a7cdd8d17ae6e97a13046ca0e005718 Mon Sep 17 00:00:00 2001 From: Tamas Herman Date: Fri, 14 May 2021 12:28:07 +0800 Subject: [PATCH] Print unresolved recursive values as their defining expression, not as `??` so it's easier to develop recursive maps. --- src/rmap/core.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rmap/core.clj b/src/rmap/core.clj index 24ea88f..2505c9a 100644 --- a/src/rmap/core.clj +++ b/src/rmap/core.clj @@ -46,7 +46,7 @@ (print-method reftag *out*)) (defmethod print-method RVal [^rmap.core.RVal rval ^java.io.Writer writer] - (.write writer "??")) + (.write writer (str "(rval " (:ref/sexp (meta (.f rval))) ")"))) (defmethod simple-dispatch RVal [^rmap.core.RVal rval] (print-method rval *out*)) @@ -64,7 +64,8 @@ not evaluated yet. The body can use the [[ref]] function while it is evaluated, or you can bind it locally for use at a later stage." [& body] - `(RVal. (fn [ref#] + `(RVal. ^{:ref/sexp '~@body} + (fn [ref#] (binding [ref ref#] ~@body))))