[racket] Code Error Creating List
Thanks for this explanation. I had not seen this error before as I am
new to Scheme. I think I understand what it is saying now. With the
double ()s it assumes the inner set is a procedure.
I am sorry my code looks so poorly, I have been doing C/C++ almost
exclusively for 10 years and I get confused when I have 9 closing )s and
I need to insert a new statement in the middle.
As far as Marco's comments earlier, I should have one function to handle
parsing the list, and upon finding an expression, pass it to the
procedure that handles expressions instead of trying to handle it all in
the same procedure. This makes sense.
Thanks for all your help. Hopefully this will help me move forward and
continue on in this project!
Todd D
On 5/18/2011 2:13 PM, Danny Yoo wrote:
> On Tue, May 17, 2011 at 8:03 PM, Todd Dobmeyer<dobmeyer.2 at wright.edu> wrote:
>> I am taking a class at Wright State University and we are working on problem
>> 3.27 from the EOPL 2nd Edition
>
> Have you seen the error message before, and do you know what it means?
>
>
> Here's an example of a program that generates a similar error message:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> #lang racket
>
> (define (square x)
> (* x x))
>
> ((square 42))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> If you run this program in DrRacket, it'll highlight the expression:
>
> ((square 42))
>
> and say:
>
> procedure application: expected procedure, given: 1764 (no arguments)
>
>
> Here, the parens in the highlighted expression mean procedure
> application. If you have experience with another programming
> language, say like JavaScript, then an equivalent kind of error would
> be something like this:
>
> square(42)() // JavaScript
>
> which should produce the error message: "TypeError: number is not a function".
>