Lisp Web Tales
With Membership
Minimum paid price

Lisp Web Tales

My attempts at learning web development, foolishly using common lisp, and even more foolishly, writing about it in public

About the Book

Why Lisp

Today we have more programming languages than we can count. Somehow, Lisp still manages to stand out, at least for me. I've been obsessed with the lisp family of languages for four years now, and I've been especially interested in Common Lisp, which I consider to be the best general purpose dialect. It is an easy language to pick up, and a difficult language to master. So far, every day spend learning lisp has been a huge plus for me, so all those difficulties have been worth it. Lisp is fun, challenging and rewarding of such efforts. No language I've picked up since or before has felt the same way, they were all either needlessly complex(most of the complexity in Lisp is there for a reason), or too simplistic and lacking in sophistication when that is needed.

As for how practical this language is for web development, It's as practical as you make it. Lisp is the perfect language for the gray areas where were we still haven't quite figured out how to do things. I believe the web is one such area, and experimentation and playful exploration of ideas is vital. This is what Lisp was designed for, not for the web specifically, but for what it is, a new playground where flexibility and creativity have room to grow. Common Lisp has been a faithful ally in my self-education. Maybe it can be one for you too.

Whats in the book

The book is a set of tutorials and examples. It uses the Common Lisp language and some of the libraries we'll be using for the examples and tutorials include:

  • The hunchentoot web server
  • The Restas web framework
  • The SEXML library for outputting XML and HTML
  • Closure-template for HTML templating
  • Postmodern for PostgreSQL access, and cl-reddis as a simple datastore
  • Various utilities

Who is this for

This book is for anyone interested in Lisp and web apps. I assume you have some familiarity with both subjects, but I don't assume you are a Lisp expert, you can just read a few tutorials to get the basics and get back to my book to get started with web apps. I've linked some of them in Appendix B. So you need to know what (+ a b) means, I won't explain html and css to you, and HTTP shouldn't be a scary mystical acronym to you. Also some knowledge of databases would be good. In other words, I assume you are a programmer, know the basics and just want to play around with lisp. Happy hacking.

About the Author

Pavel Penev
Pavel Penev

Professional web developer by day and misguided Lisp hacker whenever he can find the time for it. Lover of all things weird. Lisp, Emacs, BSD, and other 70s technology keep him from running off into the woods where he can enjoy freedom from the tyranny of JavaScript, CSS, significant white space and other obviously bad ideas that don't seem to bother anyone else.

Table of Contents

  • Preface
  • Introduction
    • Why Lisp
    • Whats in the book
    • Who is this for
    • What you need to get started
    • Typographic conventions
  • 1 The basics
    • Raw example
    • A simple blog
    • The source code
    • Source walk-through
    • Conclusion
  • 2 Setting up a project
    • Systems
    • Quicklisp and manual installation
    • restas-project
    • Setting up a hello-world project
    • Running the project
    • Conclusion
  • 3 HTML generation and templating
    • Exploring all the options
    • closure-template
  • 4 Putting it together: Updated blog example
    • Creating the project
    • Setting up defmodule.lisp
    • Updating the templates
    • Rewriting the routes
    • Post chapter refactoring
    • Running the app
  • 5 Persistence part I: PostgreSQL
    • Introduction
    • Setting up PostgreSQL
    • What is a policy?
    • Creating the project
    • The schema
    • Connecting
    • Defining the tables.
    • Defining our interface
    • Exporting the interface
    • Conclusion
  • 6 Persistence part II: The UI
    • Introduction
    • Set up
    • The templates
    • The routes
    • Getting it to run
  • 7 Persistence part III: Redis
    • Introduction
    • A note on redis
    • The “schema” or lack there of
    • The implementation
    • Handling upvotes
    • Handling links
    • Conclusion
  • 8 Modules as reusable components part I: restas-directory-publisher
    • Introduction
    • Handling static files in restas
    • Mounting modules
    • Adding a stylesheet to linkdemo
    • Contexts
    • Conclusion
  • 9 Modules as reusable components part II: Implementing a reusable module
    • Introduction
    • The interface
    • The templates
    • The routes
    • Using authdemo in an application
    • Conclusion
  • Appendix A: Getting started
    • Linux
    • Windows
  • Appendix B: Recomended reading
    • Online tutorials
    • Cliki: The Common Lisp wiki
    • IRC

Causes Supported

Electronic Frontier Foundation

Defending your civil liberties in a digital world.

Based in San Francisco, EFF is a donor-supported membership organization working to protect fundamental rights regardless of technology.

From the Internet to the iPod, technologies are transforming our society and empowering us as speakers, citizens, creators, and consumers. When our freedoms in the networked world come under attack, the Electronic Frontier Foundation (EFF) is the first line of defense. EFF broke new ground when it was founded in 1990—well before the Internet was on most people's radar—and continues to confront cutting-edge issues defending free speech, privacy, innovation, and consumer rights today. From the beginning, EFF has championed the public interest in every critical battle affecting digital rights.

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub