Racket Programming the Fun Way Cover

Racket Programming the Fun Way

From Strings to Turing Machines
by James W. Stelly
January 2021, 360 pp.

Look Inside!

Racket Programming the Fun Way backRacket Programming the Fun Way page 124Racket Programming the Fun Way pg 183Racket Programming the Fun Way pg 189Racket Programming the Fun Way Racket Programming the Fun Way Image


Download the book's code examples, card images from Chapter 5, and stock price files from Chapter 6 here.

At last, a lively guided tour through all the features, functions, and applications of the Racket programming language. You’ll learn a variety of coding paradigms, including iterative, object oriented, and logic programming; create interactive graphics, draw diagrams, and solve puzzles as you explore Racket through fun computer science topics—from statistical analysis to search algorithms, the Turing machine, and more.

Early chapters cover basic Racket concepts like data types, syntax, variables, strings, and formatted output. You’ll learn how to perform math in Racket’s rich numerical environment, and use programming constructs in different problem domains (like coding solutions to the Tower of Hanoi puzzle). Later, you’ll play with plotting, grapple with graphics, and visualize data. Then, you’ll escape the confines of the command line to produce animations, interactive games, and a card trick program that’ll dazzle your friends.

You'll learn how tot:

  • Use DrRacket, an interactive development environment (IDE) for writing programs
  • Compute classical math problems, like the Fibonacci sequence
  • Generate two-dimensional function plots and create drawings using graphics primitives
  • Import and export data to and from Racket using ports, then visually analyze it
  • Build simple computing devices (pushdown automaton, Turing machine, and so on) that perform tasks
  • Leverage Racket’s built-in libraries to develop a command line algebraic calculator

Racket Programming the Fun Way is just like the language itself—an embodiment of everything that makes programming interesting and worthwhile, and that makes you a better programmer.

Author Bio 

James W. Stelly is a semiretired systems analyst and developer of several business-line applications utilizing backend databases. He has degrees in mathematics and computer science from the University of Houston, and this book is a result of his lifelong interest in those topics.

Table of contents 

Chapter 1: Racket Basics
Chapter 2: Arithmetic and Other Numerical Paraphernalia
Chapter 3: Function Fundamentals
Chapter 4: Plotting, Drawing, and a Bit of Set Theory
Chapter 5: GUI: Getting Users Interested
Chapter 6: Data
Chapter 7: Searching for Answers
Chapter 8: Logic Programming
Chapter 9: Computing Machines
Chapter 10: TRAC: The Racket Algebraic Calculator
Appendix A: Number Bases
Appendix B: Special Symbols

All chapters are included in this Early Access PDF.

View the Copyright Page
View the detailed Table of Contents
View the Index


"Very cool. The book takes you through a logical series of chapters that build on one another, passing from the needed introduction to lists and all the basics of handling data of various types to arithmetic, functions, conditionals, into realms where Racket gets super interesting. Creating plots and graphs, GUIs, and working with data are done in ways unique to Lisp and its dialects and I really like how this book explains how to do so. The last few chapters of the book are super fascinating as they delve into topics like logic programming, computing machines, and even writing an algebraic calculator in Racket."
Matthew Helmke

"A decidedly fun and informative read that I would recommend both to novice Racket programmers and those who are looking to take a bit of a deeper dive into the language."
Micah Cantor

"The author does a great of highlighting the power of the language — the concision, the flow, the ability to distil a problem. At time it's impressive just how much can be achieved in a few lines of Racket code. For those of us using more verbose languages the difference is striking. . . . this is a book that gets my vote. It's hard work in places, and you'll need to put some effort in if you are get anywhere, but then that's exactly the kind of fun that the book promises from the outset."
—Pan Pantziarka, TechBookReport

Added to I Programmer's Book Watch

Listen to Functional Geekery Podcast's interview with James W. Stelly