; 获取文件中的所有行
(map list->string
(with-input-from-file filename
(λ ()
(let loop ((ls1 '()) (ch (read-char)) (ret '()))
(if (eof-object? ch)
(begin
(if (null? ls1)
(reverse ret)
(reverse (cons (reverse ls1) ret))))
(if (or (eq? ch #\Linefeed)
(eq? ch #\Newline)) ; #\Return
(if (null? ls1)
(loop '() (read-char) ret)
(loop '() (read-char) (cons (reverse ls1) ret)))
(loop (cons ch ls1) (read-char) ret)))))))
; 拼成完整文件
(define (read-file filename)
(apply string-append .....))