[racket] flush is not enough, a list is needed

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Nov 2 14:38:39 EDT 2012

A few minutes ago, Laurent wrote:
> Hi,
> 
> In a small Racket client/server over tcp, the client sends
> expressions that the server evaluates and returns the result to the
> client, in a loop.  The tcp ports are flushed after each send, but
> it is still hanging, unless I wrap the sent values in lists, which
> is a bit surprising.  So it looks like the buffer won't flush if
> it's not a list.

You're using just `write', so you need some whitespace between items:

> (with-input-from-string
      (with-output-to-string (λ() (write 'x) (write 'y)))
    read)
'xy

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.