Chapter 4½. (define define ’define)

#|

So far, we have covered the basics of defining variables and functions. Did you wonder if there was more to it? In this chapter, we will show you everything you need to know about definitions.

|#

4½.1 Module-Level Definitions

The most common kind of definitions are module-level definitions. These introduce names that can be accessed anywhere in the module. For now, think of a module as the definitions panel. There are two kinds of module-level definitions: variable definitions and function definitions.

Variable Definitions

Let’s begin with variable definitions. Suppose we were to develop a graphical version of the Guess My Number game from Chapter 2 that displays its results on a window of some fixed size. The ...

Get Realm of Racket now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.