UNSLISP/miniscm/test.scm

18 lines
525 B
Scheme

(define copy
(lambda (from to)
(let ((from-file (open-input-file from))
(to-file (open-output-file to)))
(letrec
((loop
(lambda ()
(let ((c (read-char from-file)))
(if (eof-object? c)
#f
(begin
(write-char to-file c)
(loop)))))))
(loop))
(close-input-port from-file)
(close-output-port to-file))))
(copy "miniscm/miniscm.c" "/tmp/miniscm-copy.c")