diff options
-rw-r--r-- | mew.scm | 18 | ||||
-rw-r--r-- | mew.svnwiki | 2 | ||||
-rw-r--r-- | tests/test.mew | 3 |
3 files changed, 14 insertions, 9 deletions
diff --git a/mew.scm b/mew.scm index 78c6558..0383116 100644 --- a/mew.scm +++ b/mew.scm @@ -126,13 +126,17 @@ (for-each display args)))) (define (prn . args) - (if (null? args) - (newline) - (begin - (write (car args)) - (unless (null? (cdr args)) - (display " ")) - (apply prn (cdr args))))) + (let loop ((args args) + (ret (void))) + (if (null? args) + (begin + (newline) + ret) + (begin + (write (car args)) + (unless (null? (cdr args)) + (display " ")) + (loop (cdr args) (car args)))))) (define-syntax def (syntax-rules () diff --git a/mew.svnwiki b/mew.svnwiki index a4916ef..142fb2a 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -223,7 +223,7 @@ Returns true if {{<va>}} is an unspecified value, else false. <procedure>(prn . <args>)</procedure> {{write}} all {{args}} separated by spaces and terminated by a newline -to the current output stream. +to the current output stream. Returns the value of the last argument. <procedure>(puts . <args>)</procedure> diff --git a/tests/test.mew b/tests/test.mew index 82c793a..82a2e71 100644 --- a/tests/test.mew +++ b/tests/test.mew @@ -93,7 +93,8 @@ (test-group "prn" (test "1 2 3\n" (with-output-to-string (fun () (prn 1 2 3)))) (test "\"a\" b #t\n" (with-output-to-string (fun () (prn "a" 'b #t)))) - (test "\n" (with-output-to-string (fun () (prn))))) + (test "\n" (with-output-to-string (fun () (prn)))) + (test 3 (esc ret (with-output-to-string (fun () (ret (prn 1 2 3))))))) (test-group "def" (test "define variable" |