O'Reilly logo

Realm of Racket by Matthias Felleisen, Eight Students of Northeastern University, David Van Horn, Conrad Barski M.D.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. (Land of Lambda)

#|

Are you tired of writing the same kind of functions over and over again? Is the list empty? Do this. Is the list non-empty? Do that. Don’t forget to recur. In this chapter, we will show you how to abstract and use lambda, something you probably didn’t see in your introductory programming courses. Al—whom you surely remember from the introduction—invented it in the 1930s, and Lisp has had it for 50 years or more. This chapter is all about lambda and its tricks.

|#

7.1 Functions as Values

Before we can begin to work with lambda, we need to discuss one key concept about functions in Racket. Functions in Racket are values, just like numbers, strings, and images. Let’s look at an example:

> add1
#<procedure:add1>

When we enter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required