mirror of
https://github.com/janet-lang/janet
synced 2025-01-24 22:26:52 +00:00
Return dbg values to work inside complex exprs
This commit is contained in:
parent
fabb722c8d
commit
59302d4f42
@ -950,16 +950,23 @@
|
|||||||
and the value for variables. Designed for quick debugging of values and
|
and the value for variables. Designed for quick debugging of values and
|
||||||
nothing else."
|
nothing else."
|
||||||
[& forms]
|
[& forms]
|
||||||
~(do
|
(with-syms [results var]
|
||||||
,;(map (fn [arg]
|
~(do
|
||||||
(def preface (if (symbol? arg)
|
(def ,results @[])
|
||||||
(string "`" arg "` has value ")
|
,;(map (fn [form]
|
||||||
"Literal has value "))
|
(def preface (if (symbol? form)
|
||||||
~(do
|
(string "`" form "` has value ")
|
||||||
(prin ,preface)
|
"Literal has value "))
|
||||||
(pp ,arg)
|
~(do
|
||||||
nil))
|
(prin ,preface)
|
||||||
forms)))
|
(def ,var ,form)
|
||||||
|
(pp ,var)
|
||||||
|
(array/push ,results ,var)))
|
||||||
|
forms)
|
||||||
|
(case (length ,results)
|
||||||
|
0 nil
|
||||||
|
1 (,results 0)
|
||||||
|
,results))))
|
||||||
|
|
||||||
(defmacro ->
|
(defmacro ->
|
||||||
"Threading macro. Inserts x as the second value in the first form
|
"Threading macro. Inserts x as the second value in the first form
|
||||||
|
Loading…
Reference in New Issue
Block a user