I am working through the EOPL Scheme exercises using DrRacket in Windows 7. When I switch from #lang racket to #lang eopl, the output from the definitions pane no longer shows up in the interaction pane. To be clear, as trivial example, running
#lang racket
4
produces
4
>
as you would expect. But running
#lang eopl
4
produces only
>
Is there anything I can do to change this behavior or is there another pane I should be looking at for output? I can, of course, evaluate expressions in the interaction pane and see the output, but this is tedious when I have multiple expressions I want to evaluate multiple times.
Looks like #lang eopl
uses #%plain-module-begin
, which does not print results, instead of #%module-begin
, which does print results.
For a quick way to switch, create the following file with the following contents:
eopl-printing.rkt
:
#lang racket
(require (except-in eopl #%module-begin))
(provide (all-from-out eopl))
(provide #%module-begin)
Then use this as the language in another file:
#lang s-exp "eopl-printing.rkt"
1
2
3
produces in my DrRacket:
Welcome to DrRacket, version 5.3.4.6 [3m].
Language: s-exp "eopl-printing.rkt" [custom].
1
2
3
>
CAVEAT: If eopl
was hiding the results for a reason, then you may get some spurious output, but I don't know for sure.
A possible workaround: print the value in the definitions pane, so it'll show up in the interactions pane. And use newline
to separate lines:
(write 4)
(newline)
(write 2)
> 4
> 2
Of course, it'll be tedious if you want to display many values, but it's an improvement.