aboutsummaryrefslogtreecommitdiffstats
path: root/miniscm/test.scm
blob: dfd219b7675780446ed4e14d942ca2922a7713ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(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")