首页 > 解决方案 > 以下将在方案中显示什么?

问题描述

我在几个(在线)方案解释器/解析器上尝试过这个表达式,有时会得到不同的答案。对于以下表达式:

(display "okkk") \; "ok;" ;"ok"

它会显示和/或返回什么?为什么?例如:

标签: schemelisp

解决方案


这可能取决于您的实现可能支持的 Scheme 语法。

例如,人们可能期望:

(display "okkk")    -> displays okkk
\;                  -> error: unbound variable
"ok;"               -> displays nothing, but returns the string
;"ok"               -> end of line comment

推荐阅读