[plt-scheme] interesting DrScheme error message

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Thu Sep 22 21:55:31 EDT 2005

I had a student who wrote code that looked something like this 
(simplified to convey the essence):

(define (f x y)
   (+ x y))

(define (g x y)
   (+
    (f x x)
    10)
   20)

Running this in Beginning Student (299.400) highlights the "f" in the 
definition of g and gives the error message:

f: name is not defined, not an argument, and not a primitive name

If, on the other hand, I replace the expression (+ (f x x) 10) with (+ 2 
10), I get the 20 highlighted, and the more reasonable error message:

define: expected only one expression for the function body, but found 
one extra part

Is there a logical explanation for this? From the student's point of 
view, the first error message is quite incomprehensible. Thanks. --PR


Posted on the users mailing list.