diff options
| author | 2024-08-22 22:43:49 -0400 | |
|---|---|---|
| committer | 2024-08-22 22:43:49 -0400 | |
| commit | 9d08c1f59e34647ac5d65b31e684e498f3aa277f (patch) | |
| tree | e4af72a9e52eb734424f590d0bb4e6443982485f /miniscm/test.scm | |
| parent | minischeme: add char (diff) | |
miniscm: add ports
Diffstat (limited to 'miniscm/test.scm')
| -rw-r--r-- | miniscm/test.scm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/miniscm/test.scm b/miniscm/test.scm new file mode 100644 index 0000000..dfd219b --- /dev/null +++ b/miniscm/test.scm @@ -0,0 +1,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")
\ No newline at end of file |
