tisp

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

commit 02bd75f3c26d67dc82aff11cf38aea079b00d89f
parent 344c615a40eb3bba52082842d100ff450bce7d7b
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Sat, 23 Mar 2019 11:28:13 -0700

Define newline function in tisp

Have newline print the character not just return it

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

diff --git a/tibs/io.c b/tibs/io.c @@ -55,16 +55,9 @@ prim_read(Env env, Val args) return v; } -static Val -prim_newline(Env env, Val args) -{ - return mk_str(env, "\n"); -} - void tib_env_io(Env env) { tsp_env_fn(print); tsp_env_fn(read); - tsp_env_fn(newline); } diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -74,4 +74,5 @@ (cond ((= n 1) 1) (t (* n (! (- n 1)))))) -(define (disp x) (print x (newline))) +(define (newline) (print "\n")) +(define (disp x) (print x) (newline)) diff --git a/tibs/repl.tsp b/tibs/repl.tsp @@ -1,7 +1,7 @@ (define (repl) (print "> ") ((lambda (expr) - (cond ((= expr 'quit) (print (newline))) + (cond ((= expr 'quit) (newline)) (t (begin ((lambda (eval-expr) (cond ((not (void? eval-expr))