Scheme中字符串的未定义标识符

时间:2014-09-20 19:55:05

标签: scheme undefined identifier

我有以下功能,我试图定义,但由于某种原因它不起作用,我得到错误。另外,我正在使用Dr. Racket进行这个项目。

“低:未定义;  不能引用未定义的标识符"

这是我定义的功能

> (define (frequency amtFrequency)
    (cond
        ((<= amtFrequency 30)“Very Low Frequency”)
        ((<= amtFrequency 300)“Low Frequncy”)
        ((<= amtFrequency 3000)“Medium Frequency”)
        ((<= amtFrequency 30000)“High Frequency”)
        ((<= amtFrequency 328600)“Very High Frequency”)
        (t# “Ultrahigh Frequency”)
    )
)
> (frequency 35)

. . “low: undefined;
 cannot reference undefined identifier
> 

1 个答案:

答案 0 :(得分:0)

这是一个文本格式化问题,您可能从一些排版不良的源代码中复制了代码,或者代码是在DrRacket之外的文本编辑器中编写的。只需将“...”替换为"..."即可。此外,建议使用else而不是#t作为最后一个条件。这应该有效:

(define (frequency amtFrequency)
  (cond
    ((<= amtFrequency 30)      "Very Low Frequency")
    ((<= amtFrequency 300)          "Low Frequency")
    ((<= amtFrequency 3000)      "Medium Frequency")
    ((<= amtFrequency 30000)       "High Frequency")
    ((<= amtFrequency 328600) "Very High Frequency")
    (else                     "Ultrahigh Frequency")))