From 96f8a969e07935f653168fdeaf334b240e1e8f5b Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 29 Jul 2014 15:42:52 +0900 Subject: [PATCH] print takes an optional argument for output port, and returns obj itself --- piclib/picrin/repl.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/piclib/picrin/repl.scm b/piclib/picrin/repl.scm index f41ce090..6a90e54b 100644 --- a/piclib/picrin/repl.scm +++ b/piclib/picrin/repl.scm @@ -14,6 +14,11 @@ "" (string-append line (loop (read-line)))))))) + (define (print obj . port) + (write obj (if (null? port) (current-output-port) (car port))) + (newline) + obj) + (define (print-help) (display "picrin scheme\n") (display "\n") @@ -36,10 +41,6 @@ (else (file->string (car args))))))) - (define (print obj) - (write obj) - (newline)) - (define (main-loop) (display "> ") (let ((expr (read)))