1#!r6rs
2;; Copyright 2009 Derick Eddington.  My MIT-style license is in the file named
3;; LICENSE from the original collection this file is distributed with.
4
5(library (yuni lib ssax private output)
6  (export
7    cout cerr nl)
8  (import
9    (rnrs))
10
11
12; like cout << arguments << args
13; where argument can be any Scheme object. If it's a procedure
14; (without args) it's executed rather than printed (like newline)
15
16(define (cout . args)
17  (for-each (lambda (x)
18              (if (procedure? x) (x) (display x)))
19            args)
20  (newline))
21
22(define (cerr . args)
23  (for-each (lambda (x)
24              (if (procedure? x)
25		  (x (current-error-port))
26		  (display x (current-error-port))))
27            args)
28  (newline (current-error-port)))
29
30;(##define-macro (nl) '(newline))
31(define nl (string #\newline))
32
33)
34