with-output-to-file   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/init.xtm

Implementation

(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)))))


Back to Index