14

Christian Queinnec has written a masterpiece called LISP In Small Pieces, which features eleven Lisp Interpreters and two Lisp compilers.

When you go to download the code from the website here - it has the comment:

The programs of this book are available on the net. 
These programs used to run with some Scheme systems around 1994.

Any idea:

(a) What Scheme systems these ran on at the time, and more importantly;

(b) What Scheme systems these would run on today?

Paulo Tomé
  • 1,910
  • 3
  • 18
  • 27
hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • 1
    Why don't you just install racket and attempt to run a few of the programs? – Dan D. Apr 28 '12 at 09:49
  • I use guile https://en.wikipedia.org/wiki/GNU_Guile or Kawa https://en.wikipedia.org/wiki/Kawa_(Scheme_implementation) – jcubic Apr 28 '12 at 10:08
  • @jcubic So the programs in this book worked for you? – hawkeye Apr 28 '12 at 11:07
  • 1
    @hawkeye no I just what to say that as scheme implementation in my daily usage I use those implementations. One note: if the code that you try to run have brackets instead of parent in some places like in `let` then it will work only on drScheme or racket, and drScheme is not real scheme because real scheme don't use brackets. – jcubic Apr 28 '12 at 11:24
  • 5
    @jcubic That's a little harsh. My opinions on square brackets notwithstanding, it's part of R6RS and has been with a number of major implementations (like Chez and Racket) for a long time. You can't say they aren't real Scheme implementations. – C. K. Young Apr 28 '12 at 13:03
  • It desn't work on guile or kawa and Raket is different language (wikipedia says that it's Influenced by Scheme and Eiffel), it's not scheme. and braket look more like clojure to me then scheme or lisp that should be create from S-Expressions but that's only my opinion. I only wanted to say that when I was learning scheme I read one book where the only implementation that I can run those examples was drScheme, So I find another book, – jcubic Apr 28 '12 at 16:16
  • 2
    Actually, Guile has accepted square brackets by default for [over two years](http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=5afa815c9cd4550bf93181bc0ed0134aa83dfc5d). – Asumu Takikawa Apr 28 '12 at 20:08
  • @jcubic Chicken also optionally accepts square brackets.. I'm not personally fond of that style, but at this point it really does just seem to be preference. – robbyphillips May 03 '12 at 11:46
  • @AsumuTakikawa To which version it belong to, I use guile 1.8.7 and this `(let ([x 10]) (* x x))` throw `Bad binding [x in expression (let ([x 10]) (* x x)). ABORT: (syntax-error)` the same if I call `[* 10 20]` it throw `Unbound variable: [*` display 10 and then throw `Unbound variable: 20]` – jcubic May 03 '12 at 12:12
  • @jcubic Judging from the release dates, I think Guile 1.8.8 started accepting square brackets. – Asumu Takikawa May 03 '12 at 13:40

5 Answers5

8

There's a lot of programs in there. I did a few tests to see how well I could answer this without having to try them individually. There are 131 files in the tarball with extension ".scm". However there appear to be Scheme programs with other extensions such as .bgl. So I did a search for files containing 'L i S P' in the first five lines. That yields 173 files. I tried running all of these on my preferred Scheme implementation. 31 of these run without error. Almost all of these are in the "src" directory. So the language-specific programs really do seem language-specific. Let's look at one of the src/ files that failed, "chap9z.scm". It's choking on define-abbreviation. I don't know the origin of this symbol, but it's not defined anywhere in guile. But all of its uses could be performed by guile's syntax-rules.

gcbenison
  • 11,723
  • 4
  • 44
  • 82
6

Some Scheme implementations that existed in 1994 still are still around and maintained: Scheme 48, Chez Scheme, Gambit, Bigloo, MIT Scheme and SCM.

Probably the code from LiSP will run in other modern Scheme systems such as Guile or Larceny.

Personally, I would recommend using Racket. Most likely, much of the code will run in #lang racket with no changes, and there's no requirement to use [] (but your code may be easier to read :). Things that don't work are probably easy to fix, and you can also use the R5RS language implementation provided by Racket which will likely work for all of the code.

Sam Tobin-Hochstadt
  • 4,983
  • 1
  • 21
  • 43
  • The code (at least from ch. 1) doesn't run 'as-is' in #lang racket due to con cells not being mutable. – PuercoPop Jun 25 '14 at 06:14
  • 1
    You can probably run it in the `r5rs` mode (either select that language in DrRacket, use the `plt-r5rs` executable`, or add `#lang r5rs` at the top of the file). – Sam Tobin-Hochstadt Jun 25 '14 at 13:11
5

(a) What Scheme systems these ran on at the time

The Makefile in the source tarball from the author's website has targets for running the code under bigloo, elk, gambit, mit-scheme, scheme2c, and scm.

The Makefile mentions SCM 4e1 and Bigloo 1.9d as known working versions, though I haven't tested them myself. I didn't find any mention of specific versions for the other schemes.

(b) What Scheme systems these would run on today?

The code in this github repo has been updated so that almost all of the tests in the included test suite pass with current (as of 06/2014) versions of bigloo, gambit, and mit-scheme.

If you just want to be able to run the code and follow along with the book, one of those schemes should work for you.

[full disclosure: I'm the owner of the repo and I'm a Scheme noob. The code in the repo is WOMM certified, but your mileage may vary.]

If, on the other hand, you're not content to use bigloo / gambit / mit-scheme, it shouldn't be too hard to add support for guile / racket / insert-favorite-scheme-here. Use one of the book.* files as a starting point, e.g. gambit/book.scm or mitscheme/book.mit. If you can get a version of book.scm to load in your favorite scheme, then have a look at the test.interpreters make target, and finally the grand.test target to verify things are working as expected.

appleby
  • 41
  • 1
  • 3
2

The included README file states:

These files were tested with a Scheme interpreter augmented with a test-suite driver (tester.scm), the define-syntax and define-abbreviation macros (using Dybvig's syntax-case package), and an object system: Meroonet (meroonet.scm).

Bigloo, Scheme->C, Gambit, Elk or SCM can be used. The first three are better since a specialized interpreter may be built that contains a compiled Meroonet and compiled hygienic macros.

kmkaplan
  • 18,655
  • 4
  • 51
  • 65
0

Apparently Appleby has posted an updated version of the source code. Racket is missing though )=

See https://github.com/appleby/Lisp-In-Small-Pieces

PuercoPop
  • 6,707
  • 4
  • 30
  • 40