Skip to Main Content
Realm of Racket
book

Realm of Racket

by Conrad Barski M.D., David Van Horn, Eight Students of Northeastern University, Matthias Felleisen
June 2013
Intermediate to advanced content levelIntermediate to advanced
312 pages
6h 47m
English
No Starch Press
Content preview from Realm of Racket

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Elm in Action

Elm in Action

Richard Feldman
Handbook of Constraint Programming

Handbook of Constraint Programming

Francesca Rossi, Peter van Beek, Toby Walsh

Publisher Resources

ISBN: 9781457185120Errata