Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resurrecting old PLT-Scheme project (pre-1999)

Tags:

scheme

racket

I'm trying to resurrect an old (1999 or earlier) project written in Scheme (PLT-Scheme, using the mzscheme interpreter (?) commandline tool). To make the matters worse, I don't know Scheme, or Lisp (in fact, I want to learn, but that's another story).

I have the source code of the project at:

github.com/akavel/sherman

Now, when running the code, it bails out with an error message like below:

Sherman runtime version 0.5
Hosted on MzScheme version 52, Copyright (c) 1995-98 PLT (Matthew Flatt)
reference to undefined identifier: list->block

(I've tried PLT-Scheme versions 52, 53, 103, 103p1. Earlier versions don't allow mzscheme -L option, which is referenced in the sherman.bat script used in the project. Later versions also have some more serious problems with the code or options.)

The difficulty is, that from what I see, list->block actually is defined - see: collects/sherman/BLOCK.SS line 48. So, what is wrong?

To run the code, I perform the following steps:

  1. Download PLT-Scheme v. 103p1 (from the old versions download page - first closing the "PLT Scheme is now Racket" banner) - for Windows, use: mz-103p1-bin-i386-win32.zip.
  2. Unzip (e.g. to directory c:\PLT).
  3. Copy c:\sherman\collects\sherman directory with contents to: c:\PLT\collects\sherman (where c:\sherman contains the contents of the github repository).
  4. Run cmd.exe, then cd c:\sherman.
  5. set PATH=c:\PLT;%PATH%
  6. sherman.bat run trivial.s
    • this command is in fact, from what I understand, equivalent to:
(require-library "runtime.ss" "sherman")
(parameterize ((current-namespace sherman-namespace)) (load "trivial.s"))
(current-namespace sherman-namespace)
  • After that, I get the error as described above (MzScheme version would be reported as 103p1 or whatever).

Could you help me solve the problem?

EDIT 2: SOLVED!

To whom it may concern, I've added a fully fledged "How to use this project" instruction on the project page, detailing the solution to the problem thanks to soegaard's help.

In short:

copy trivial.s trivial.rs
rem (the above is workaround for problems with 'r2s.exe < trivial.r > trivial.rs')
sherman.bat compile trivial.rs
sherman.bat run trivial.zo
rem (or: sherman.bat run trivial.ss)
like image 645
akavel Avatar asked Sep 22 '12 22:09

akavel


1 Answers

Not an answer, but a few notes too big for a comment.

1. Sanity Check

The error message says list->block is undefined. Make sure that the code in block.ss is run, by inserting (display "block.ss is loaded!") in block.ss just to make sure, the code is run.


2. Random Thoughts

The file blocks.ss begins with:

(require-library "functios.ss")
(require-library "synrule.ss")
(require-library "stream.ss" "sherman")

The file "sherman/stream.ss" is in the repository, but where is "synrule.ss" and "functios.ss" ?

Ah... This code is old! Here is a description of how require-library worked. It lists functios.ss and synrule.ss as part of MzLib.

http://www.informatik.uni-kiel.de/~scheme/doc/mzscheme/node158.htm

Let's check out how require-library worked:

When require-library is used to load a file, the library name and the resulting value(s) are recored in a table associated with the current namespace. If require-library is evaluated for a library that is already registered in the current namespace's load table, then the library is not loaded again; the result(s) recorded in the load table is returned, instead.

So when the code in block.ss is run, the names are stored in a namespace. If the current namespace is the wrong one, when the code in block.ss is evaluated, it would explain you error message of list->block being undefined.

like image 143
soegaard Avatar answered Oct 12 '22 07:10

soegaard