Land of Lisp: Learn to Program in Lisp, One Game at a Time!

Land of Lisp: Learn to Program in Lisp, One Game at a Time!

Conrad Barski

Language: English

Pages: 504

ISBN: 1593272812

Format: PDF / Kindle (mobi) / ePub


Lisp has been hailed as the world's most powerful programming language, but its cryptic syntax and academic reputation can be enough to scare off even experienced programmers. Those dark days are finally over—Land of Lisp brings the power of functional programming to the people!

With his brilliantly quirky comics and out-of-this-world games, longtime Lisper Conrad Barski teaches you the mysteries of Common Lisp. You'll start with the basics, like list manipulation, I/O, and recursion, then move on to more complex topics like macros, higher order programming, and domain-specific languages. Then, when your brain overheats, you can kick back with an action-packed comic book interlude!

Along the way you'll create (and play) games like Wizard Adventure, a text adventure with a whiskey-soaked twist, and Grand Theft Wumpus, the most violent version of Hunt the Wumpus the world has ever seen.

You'll learn to:

  • Master the quirks of Lisp's syntax and semantics
  • Write concise and elegant functional programs
  • Use macros, create domain-specific languages, and learn other advanced Lisp techniques
  • Create your own web server, and use it to play browser-based games
  • Put your Lisp skills to the test by writing brain-melting games like Dice of Doom and Orc Battle

With Land of Lisp, the power of functional programming is yours to wield.

More iPhone Development with Objective-C (3rd Edition)

Learning R

Debugging

Unity Shaders and Effects Cookbook

 

 

 

 

 

 

 

 

 

 

 

 

 

captured continuation. The only part of the foo command that happens after the continuation was captured is the multiplication by two . Consequently, the variable continuation is now a time machine that we can use to jump into this past moment to switch out the number we want to double with another one. So, if we were to now call (continuation 100), it would return 200 (which is 100 doubled). We have traveled backward in time! Weakness Continuations are such an awesome feature that they

operator: > #'half # The lambda command just lets you do these same two things in a single step. You can define a function and then get it, without giving your function a name: > (lambda (n) (/ n 2)) # The first parameter to the lambda command is a parameter list, no different from the parameter list used in defun. The rest of the parameters are just the commands for the body of the unnamed function. Once you have a value representing your unnamed

is that some of these extra tokens (for, below, and sum) appear to have special meanings. Recall from Chapter 3 that the first token in a form (the one immediately after the opening parenthesis) is typically what decides the basic behavior of the code, while the rest of the form contains parameters. Within the loop macro, several of these “magic tokens” fundamentally affect the loop’s behavior. Here’s what they mean: for allows you to declare a variable (in this case, named i) that iterates

is that some of these extra tokens (for, below, and sum) appear to have special meanings. Recall from Chapter 3 that the first token in a form (the one immediately after the opening parenthesis) is typically what decides the basic behavior of the code, while the rest of the form contains parameters. Within the loop macro, several of these “magic tokens” fundamentally affect the loop’s behavior. Here’s what they mean: for allows you to declare a variable (in this case, named i) that iterates

need to define a structure that stores the properties of each animal in our game: (defstruct animal x y energy dir genes) Let’s take a look at each of these fields in detail. Anatomy of an Animal We need to track several properties for each animal. First, we need to know its x- and y-coordinates. This indicates where the animal is located on the world map. Next, we need to know how much energy an animal has. This is a Darwinian game of survival, so if an animal can’t forage enough

Download sample

Download

About admin