~ chicken-r7rs (master) /scheme.file.scm
Trap1(module scheme.file (call-with-input-file
2 call-with-output-file
3 call-with-input-file
4 delete-file
5 open-binary-input-file
6 open-input-file
7 with-input-from-file
8 call-with-output-file
9 file-exists?
10 open-binary-output-file
11 open-output-file
12 with-output-to-file)
13 (import scheme chicken.type)
14 (import (rename (only chicken.file delete-file file-exists?)
15 (file-exists? chicken-file-exists?)))
16
17 ;; CHICKEN's file-exists? returns the filename when true,
18 ;; whereas R7RS requires it to return #t or #f.
19
20 (: file-exists? (string -> boolean))
21
22 (define (file-exists? filename)
23 (and (chicken-file-exists? filename) #t))
24
25 (: open-binary-input-file (string -> input-port))
26 (: open-binary-output-file (string -> output-port))
27
28 (define (open-binary-input-file path) (open-input-file path #:binary))
29 (define (open-binary-output-file path) (open-output-file path #:binary))
30
31)