On Fri, Nov 2, 2012 at 7:48 PM, Laurent <laurent.ors...@gmail.com> wrote:

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

>
> Wow, thanks a lot, I would have never thought about that. I thought that
> 'write' was sending data, not mere characters.
> Writing a space after each output indeed solves the problem.
>

For reference, one needs to use (printf " ")  or (display " ") but not
(write " ") or (print " "), because, IIUC, 'write' does send data, but does
not add delimiters to the data if there are none yet.
I.e., a string like " " is self-delimited, a list (a b c) is also
self-delimited, but symbols and numbers are not. This means that the
delimiter must be added by hand.
'display' sends a space to the stream, whereas 'write' sends a
self-delimited data string " ".

Laurent
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to