From 59302d4f420c2e940aa8a55ba077251a593cf81c Mon Sep 17 00:00:00 2001 From: LouisJackman <11330428+LouisJackman@users.noreply.github.com> Date: Sat, 16 May 2020 15:42:16 +0100 Subject: [PATCH] Return dbg values to work inside complex exprs --- src/boot/boot.janet | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 87ea307e..415481e7 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -950,16 +950,23 @@ and the value for variables. Designed for quick debugging of values and nothing else." [& forms] - ~(do - ,;(map (fn [arg] - (def preface (if (symbol? arg) - (string "`" arg "` has value ") - "Literal has value ")) - ~(do - (prin ,preface) - (pp ,arg) - nil)) - forms))) + (with-syms [results var] + ~(do + (def ,results @[]) + ,;(map (fn [form] + (def preface (if (symbol? form) + (string "`" form "` has value ") + "Literal has value ")) + ~(do + (prin ,preface) + (def ,var ,form) + (pp ,var) + (array/push ,results ,var))) + forms) + (case (length ,results) + 0 nil + 1 (,results 0) + ,results)))) (defmacro -> "Threading macro. Inserts x as the second value in the first form