Skip to content
/ cl Public

Solutions to some exercises from the book ANSI Common Lisp

Notifications You must be signed in to change notification settings

ctsrc/cl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solutions to some exercises from the book ANSI Common Lisp

This repository contains solutions that I have written to a few of the exercises from the book ANSI Common Lisp by Paul Graham. The book came out in year 1996, and is an interesting read today (year 2021) as well, in my opinion.

Paul Graham

pg, as you may know, was one of the co-founders of Y Combinator, the first of a new type of startup incubator. Prior to that he co-founded Viaweb, in 1995. They wrote Viaweb partially in Lisp.

pg has written a couple of other books as well, including Hackers & Painters: Big Ideas from the Computer Age. This other book I have read also and I enjoyed that one too.

The book ANSI Common Lisp

You can read reviews and stuff about the book ANSI Common Lisp here:

https://www.goodreads.com/book/show/41801.ANSI_Common_Lisp

And you can see the Amazon listing for the book here (affiliate link):

An image showing the cover of the book ANSI Common Lisp by Paul Graham

ANSI Common Lisp listing on Amazon

You will probably want to buy it used. That's what I did. I mean, it's a good book, but I don't think almost any book should cost you >$100 USD in 2021-dollars. Somewhere between $15 and $45 is a fair price in 2021-dollars for most good books.

Buying it used from Amazon you can get it at a decent price. Buying it new from Amazon will cost you over $100 at the moment. So yeah, buy it used somewhere. Either at Amazon or someplace else.

About these solutions

All the solutions include a comment at the start of the file, with a reproduction of the assignment text so that it makes sense to the reader what the program is trying to do without having to consult with the paperback copy of the ANSI Common Lisp book.

Exercise solutions are named according to chapter and exercise number.

Running the solutions

Before attempting to run any of the solutions, please ensure that you have the necessary dependencies installed on your computer. You can find a list of dependencies that need to be installed in the section titled Prerequisites, below.

Run any of the solutions, e.g.:

./e-10-1.cl

Special notes about running some of the solutions

  • e-11-2.cl produces a file named spheres.pgm as its output. The PGM format is a lowest common denominator grayscale file format. It is designed to be extremely easy to learn and write programs for. See http://netpbm.sourceforge.net/doc/pgm.html for details about the PGM format.

    On macOS you can open spheres.pgm or double-click on it and by default it will open in Preview where you can view it. On other platforms there are programs that allow you to view PGM files as well. Look up the details for your platform online.

Prerequisites

The following dependencies need to be installed in order to run the code in this repository and in order to be able to view the generated output:

  • Steel Bank Common Lisp
  • Graphviz

The subsections that follow explain how to install these dependencies on some common Unix operating systems, including macOS, FreeBSD and some popular Linux distros.

macOS

Assuming you have Homebrew installed:

brew install sbcl graphviz

FreeBSD

(The command below needs to be run as root, I recommend using doas to execute commands as root.)

pkg install sbcl graphviz

Linux

Use the package manager or other type of preferred installation method that they use on your distro. Here's how to do it for some of the most common Linux distros.

Debian / Ubuntu / KDE Neon / most Debian derivatives:

sudo apt-get install sbcl graphviz

Fedora

sudo dnf install sbcl graphviz

openSUSE Tumbleweed

sudo zypper install sbcl graphviz

openSUSE Leap

Package sbcl is not available for openSUSE Leap 15.3 at the time of this writing according to https://software.opensuse.org/package/sbcl

Package graphviz is not available for openSUSE Leap 15.3 at the time of this writing according to https://software.opensuse.org/package/graphviz

Arch Linux

sudo pacman -S sbcl graphviz

Gentoo Linux

emerge --ask dev-lisp/sbcl media-gfx/graphviz

About

Solutions to some exercises from the book ANSI Common Lisp

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published