I have the following function below that I am trying to define, but for some reason it does not work, I get the error. On a side note, i am using Dr. Racket for this project.
“low: undefined; cannot reference undefined identifier"
this is the function that I have defined
> (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
>
It's a text-formatting problem, you probably copied the code from some poorly typeset source, or the code was written in a text editor other than DrRacket's. Just replace “...”
with "..."
. Also, it's recommended to use else
and not #t
for the last condition. This should work:
(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")))