DrRacket EOPL 方案输出 [英] DrRacket EOPL Scheme output

查看:57
本文介绍了DrRacket EOPL 方案输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Windows 7 中使用 DrRacket 完成 EOPL Scheme 练习.当我从 #lang racket 切换到 #lang eopl 时,定义窗格的输出不再显示在交互窗格中.明确地说,作为一个简单的例子,运行

#lang球拍4

产生

4>

正如你所料.但是跑步<前>#lang eopl4

只产生

>

我可以做些什么来改变这种行为,或者我应该查看另一个窗格以获取输出吗?当然,我可以在交互窗格中计算表达式并查看输出,但是当我有多个表达式要计算多次时,这很乏味.

解决方案

看起来像 #lang eopl 使用 #%plain-module-begin,它不打印结果,而不是 #%module-begin,它会打印结果.

为了快速切换,创建以下文件,内容如下:

eopl-printing.rkt:

#lang球拍(需要(除了在 eopl #%module-begin 中))(provide (all-from-out eopl))(提供#%module-begin)

然后将其用作另一个文件中的语言:

#lang s-exp "eopl-printing.rkt"123

在我的 DrRacket 中产生:

欢迎使用 DrRacket,版本 5.3.4.6 [3m].语言:s-exp "eopl-printing.rkt" [自定义].123>

注意:如果 eopl 出于某种原因隐藏了结果,那么您可能会得到一些虚假输出,但我不确定.

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.

这篇关于DrRacket EOPL 方案输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆