[racket] expected at least one argument name after the function name

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Mon Nov 15 09:54:34 EST 2010

On Nov 12, 2010, at 4:54 PM, Jim Wise wrote:

> I've noticed that beginning student language does not allow definition
> of a function which takes no arguments....
> It's not obvious to me why this is the case.  I can sort of guess at the
> reasoning, and it makes some sense -- such a function is obviously not a
> pure function...
> but I'm teaching a sixth grader who's coming to Racket from LOGO (and
> starting HtDP), and she would like to reproduce some of the things she's
> done with turtle graphics using Racket and graphics/turtles....

The "turtle" model of graphics is inherently sequential/imperative, so in DrRacket you won't be able to do it without going to Advanced Student language and using "begin".

But you can make equally interesting pictures (and more) by using a functional model of graphics, as is provided by the "image", "universe", and "picturing-programs" teachpacks in DrRacket.  Rather than each function adding something to a global drawing space, each function returns an image, and these images can then be glued together and manipulated in various ways (horizontal and vertical concatenation, scaling, rotation, reflection, overlaying, etc.)  Some of the primitives give you line segments, which enable you to do anything you could do with a turtle.  OTOH, it's a pain using a turtle to draw solid areas and shapes, which is quite easy using functional graphics.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.