mit-scheme-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using open-i/o-file function


From: Nicholas Papadonis
Subject: using open-i/o-file function
Date: Sat, 3 Apr 2021 20:23:35 -0400

I'm using MIT Scheme 10.1.5 and am curious why the following code using open-i/o-file is not working as I expected. Does anyone know what the issue is?
(define l "~/tmp0")
(define x ''(a b (c d) e f))

(let ((p (open-i/o-file l)))
  (begin (write x p)
     (flush-output p)
     (let ((r (read p)))
       (close-port p)
       r)))
;Value: #!eof
when I was expecting:
;Value: (quote (a b (c d) e f))
When using open-input-file or open-output-file the results are expected:
(let ((p (open-output-file l)))
  (write x p)
  (close-port p))

(let ((p (open-input-file l)))
  (let ((r (read p)))
    (close-port p)
    r))
;Value: (quote (a b (c d) e f))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]