-
-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Labels
Description
Rather than simply showing the last form return value, use the contents of &env to display a table of all the local bindings at a given point, as discussed with @Malabarba in gitter.
(defmacro locals [] (zipmap (map #(list 'quote %) (keys &env)) (keys &env)))
This will likely include some autogenerated locals (for destructuring, macros, etc.). These aren't likely to be too distracting, but a simple heuristic of whether a name consists of an underscore #[_]
should filter out all of these (maybe have a toggle?)
(defn remove-autogenerated-locals
"Remove any locals generated by macros (heuristic - named something
with underscores in it). When we're doing something other than
println with the data, these could be left in but it's a bit noisy
at the moment"
[coll]
(into {} (remove (fn [[k v]] (re-find #"[_]" (name k))) coll)))