RosettaCodeData/Task/Read-entire-file/Scheme/read-entire-file-1.ss
2014-01-17 05:34:36 +00:00

8 lines
238 B
Scheme

(with-input-from-file "foo.txt"
(lambda ()
(reverse-list->string
(let loop ((char (read-char))
(result '()))
(if (eof-object? char)
result
(loop (read-char) (cons char result)))))))