Scheme implementation : tinyscheme
Here is my try:
(with-output-to-file "biophilia.c"
(lambda (output-port)
(write "Hello" output-port)))
Ceates biophilia.c with following content:
Error: ( : 26) not enough arguments
What am I doing wrong here? how to repair it?
(define (with-output-to-file s p)
(let ((outport (open-output-file s)))
(if (eq? outport #f)
#f
(let ((prev-outport (current-output-port)))
(set-output-port outport)
(let ((res (p)))
(close-output-port outport)
(set-output-port prev-outport)
res)))))