UNSLISP/miniscm/test.scm

18 lines
525 B
Scheme
Raw Normal View History

2024-08-22 22:43:49 -04:00
(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")