print takes an optional argument for output port, and returns obj itself

This commit is contained in:
Yuichi Nishiwaki 2014-07-29 15:42:52 +09:00
parent f09a27cd0a
commit 96f8a969e0
1 changed files with 5 additions and 4 deletions

View File

@ -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)))