1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-01 04:19:55 +00:00

Adopt Andrew Chamber's suggestions

This commit is contained in:
LouisJackman 2020-05-18 21:55:21 +01:00
parent e0130e7fd7
commit e9a5cfaddd
No known key found for this signature in database
GPG Key ID: C83A456999EEBC34

View File

@ -945,7 +945,7 @@
(array/push parts (tuple apply f $args))) (array/push parts (tuple apply f $args)))
(tuple 'fn (tuple '& $args) (tuple/slice parts 0))) (tuple 'fn (tuple '& $args) (tuple/slice parts 0)))
(defmacro trace-pp (defmacro tracev
"Displays the variables or literals listed, providing both the name and "Displays the variables or literals listed, providing both the name and
and the value for variables. Designed for quick debugging of values. Returns and the value for variables. Designed for quick debugging of values. Returns
the traced forms: nil for none, the form itself for one, and a tuple of the the traced forms: nil for none, the form itself for one, and a tuple of the
@ -955,13 +955,12 @@
~(do ~(do
(def ,results @[]) (def ,results @[])
,;(map (fn [form] ,;(map (fn [form]
(def preface (if (symbol? form)
(string form " is")
"Expression is"))
~(do ~(do
(def ,var ,form) (def ,var ,form)
(eprintf (string "%s " (dyn :pretty-format "%q")) (eprintf (string (dyn :pretty-format "%q")
,preface " is "
(dyn :pretty-format "%q"))
',form
,var) ,var)
(eflush) (eflush)
(array/push ,results ,var))) (array/push ,results ,var)))