[plt-scheme] no #!eof

From: Jens Axel Soegaard (jensaxel at soegaard.net)
Date: Tue Apr 15 03:26:50 EDT 2008

Andrew Reilly wrote:
> On Tue, Apr 15, 2008 at 12:55:40AM -0400, Abdulaziz Ghuloum wrote:
>> On Apr 15, 2008, at 12:18 AM, Andrew Reilly wrote:
>> Have you never seen an eof midstream?
> 
> Honestly, no.  If it's in the middle, it clearly can't be at the end.

Puzzle: What is the expected output of the following?

#!scheme

(define file "/tmp/tmp.txt")

(thread
  (lambda ()
    (with-output-to-file file
      (lambda ()
        (let loop ()
          (sleep 2)
          (write "foo\n")
          (loop)))
      #:exists 'replace)))

(sleep 0.5)

(with-input-from-file file
   (lambda ()
     (let loop ()
       (display (read-line))
       (newline)
       (sleep 1)
       (loop))))




-- 
Jens Axel Søgaard


Posted on the users mailing list.