(let loop ()
(let ((char (read-char port)))
(cond ((eof-object? char)
- (let ((string (builder)))
- (if (fix:= 0 (string-length string))
- char
- string)))
+ (if (builder 'empty?)
+ char
+ (builder)))
((char=? char #\newline)
(builder))
(else
(let loop ()
(let ((char (read-char port)))
(cond ((eof-object? char)
- (let ((string (builder)))
- (if (fix:= 0 (string-length string))
- char
- string)))
+ (if (builder 'empty?)
+ char
+ (builder)))
((char-set-member? delimiters char)
(input-port/unread-char port char)
(builder))
(set! index 0)
unspecific)
+ (define (empty?)
+ (and (fix:= 0 index)
+ (null? buffers)))
+
(define (append-char! char)
(if (not (fix:< index buffer-size))
(new-buffer!))
(cond ((default-object? object) (build))
((bitless-char? object) (append-char! object))
((string? object) (append-string! object))
+ ((eq? 'empty? object) (empty?))
(else (error "Not a char or string:" object)))))))
\f
(define (string-copy! to at from #!optional start end)