tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit c18c502f114bd4e9829d25e2d99dc87ad0813662
parent 2060059df75b5a39b93d237b039ead8f12ba5f71
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Fri, 29 Mar 2019 17:16:21 -0700

Print quotes around string in REPL

Diffstat:
tibs/io.c | 2--
tibs/lib.tsp | 5+++++
tibs/repl.tsp | 2+-
3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tibs/io.c b/tibs/io.c @@ -34,8 +34,6 @@ prim_print(Env env, Val args) fprintf(stdout, "%s", car(v)->v.s); else tisp_print(stdout, car(v)); - if (!nilp(cdr(v))) - putchar(' '); } fflush(stdout); return env->none; diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -76,3 +76,8 @@ (define (newline) (print "\n")) (define (disp x) (print x) (newline)) +(define (disp-string str) + (cond + ((string? str) (print "\"" str "\"")) + (t (print str))) + (newline)) diff --git a/tibs/repl.tsp b/tibs/repl.tsp @@ -5,7 +5,7 @@ (t (do ((lambda (ans) (cond ((not (void? ans)) - (disp ans)))) + (disp-string ans)))) (eval expr)) (repl))))) (read)))