aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormryouse2022-07-10 21:13:41 +0000
committermryouse2022-07-10 21:13:41 +0000
commit9226c0221e603668346676fffa8dc49e934882d3 (patch)
treeb9bbfc3687e49e33a75f0e9ce9a8561892e6edab
parent5194669bd08d7cabefe1e22e72de75df5443af38 (diff)
strings should be printed with surrounding quotes
-rw-r--r--repl.neb9
1 files changed, 8 insertions, 1 deletions
diff --git a/repl.neb b/repl.neb
index 77faed6..cc8ae06 100644
--- a/repl.neb
+++ b/repl.neb
@@ -33,6 +33,12 @@
(redef tmp (strip (read-line (prompt next-cmd-num)))))
tmp)
+ (func print-result (res)
+ (print (concat "=> "
+ (if (eq? :string (typeof res))
+ (concat "\"" res "\"")
+ (->string res)))))
+
; this is the actual loop part
(while #true
(def this-cmd (get-non-empty-input))
@@ -43,10 +49,11 @@
(block
(redef panicked #true)
_panic_)))
+
(if panicked
(print (concat "panic! " evaluated))
(block
- (print (concat "=> " (->string evaluated)))
+ (print-result evaluated)
(redef next-cmd-num (+ 1 next-cmd-num))
(redef _history_ (append _history_ this-cmd))))))