[plt-scheme] (thread read)
Chongkai Zhu skrev:
> What is
>
> (thread read)
>
> suppose to do? Trying on both DrScheme and MzScheme, version 370 [3m], I
> got different effects (in DrScheme, even different from run to run).
>
> Doing more experiments in DrScheme only confuse me more. Could anyone
> help clarify? Thanks.
The original thread (the REPL) and the new thread share the input port.
When you type something at the REPL either the REPL *or* the new thread
will read it. If the thread reads it, nothing happens. If the
REPL reads it it gets evaluated as usual.
If the REPL reads part of an expression and the threads read some
then...
Compare:
(parameterize
([current-input-port
(open-input-string "This is read by the thread")])
(thread (lambda ()
(display (read)))))
--
Jens Axel Søgaard