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?

10
  • 1
    Why don't you just install racket and attempt to run a few of the programs? Commented Apr 28, 2012 at 9:49
  • I use guile en.wikipedia.org/wiki/GNU_Guile or Kawa en.wikipedia.org/wiki/Kawa_(Scheme_implementation) Commented Apr 28, 2012 at 10:08
  • 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. Commented Apr 28, 2012 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. Commented Apr 28, 2012 at 13:03
  • 2
    Actually, Guile has accepted square brackets by default for over two years. Commented Apr 28, 2012 at 20:08

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I bet that define-abbreviation is defined as a macro somewhere else in the source.
I looked but haven't found it. I need an sexp - based (rather than line-based) grep!
@gcbeison, it seems to be defined in the platform-specific portions. For example, see elk/book.elk, where it's defined via a call to expand-syntax.
That's awesome - you've made a really big effort to answer the question.
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.

2 Comments

The code (at least from ch. 1) doesn't run 'as-is' in #lang racket due to con cells not being mutable.
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).
6

(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.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.