with-input-from-file   scheme


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

Implementation

(define (with-input-from-file s p)
  (let ((inport (open-input-file s)))
    (if (eq? inport #f)
        #f
        (let ((prev-inport (current-input-port)))
          (set-input-port inport)
          (let ((res (p)))
            (close-input-port inport)
            (set-input-port prev-inport)
            res)))))


Back to Index