[racket] Code Error Creating List

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed May 18 14:13:48 EDT 2011

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".


Posted on the users mailing list.