commit 58a0240520c7974cb02184d4e6738094484daec3
parent af8587a599838cfcb0d6a3b69def48b72dc24d81
Author: Ed van Bruggen <edvb@uw.edu>
Date: Mon, 23 Dec 2019 17:59:07 -0800
Optional file name for newline to append a newline
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -254,7 +254,10 @@
;;; IO
(define (print . str) (apply write (list* 'stdout nil str)))
-(define (newline) (print "\n"))
+(define (newline . file)
+ (if (or (nil? file) (nil? (cdr file)))
+ (write (car (or file '(stdout))) file "\n")
+ (error 'newline "only zero or one file can be given")))
(define (disp . str) (apply print str) (newline))
; TODO rename displayln, also quote syms and lists
(define (disp-string . str)