What's New?

1999-07-02
Some fixes from Pekka Pirinen for initializing variables and a genuine bug in add-physical-out-interface. The package stuff has been split out to it's own file too.
1999-04-15
Some fixes from Arther Lemmens. make-sequence was being called with invalid sequences. Some tests were also added to catch for these errors. Some small changes for CLISP were also made. See the RCS logs for more details.
1998-06-10
Fixed a long-standing bug in scan-range: the initial values of the loop variables were almost always initialized with fixnums despite what :type might say. This is wrong if :type is specified such that fixnum is not a valid subtype. This change is a bit of a hack, but it appears to work with all systems I've tried.
1998-06-04
Fixed some serious errors in the tests when I renamed a macro from T (ACL complains about this) to TO. There already was a macro named TO. Changed to TON.

Lisp Series Package

This is my modified version of Richard Water's series package. For more information about this package, refer to Appendix A in Common Lisp the Language, 2nd Edition. This package is also described in two reports available. Search for the reports AI Memo 1082 and AI Memo 1083 on MIT AI Lab: Publications Database Search Results

The introduction says

Series combine aspects of sequences, streams, and loops. Like sequences, series represent totally ordered multi-sets. In addition, the series functions have the same flavor as the sequence functions-namely, they operate on whole series, rather than extracting elements to be processed by other functions. For instance, the series expression below computes the sum of the positive elements in a list.
      (collect-sum (choose-if #'plusp (scan '(1 -2 3 -4)))) => 4

Like streams, series can represent unbounded sets of elements and are supported by lazy evaluation: each element of a series is not computed until it is needed. For instance, the series expression below returns a list of the first five even natural numbers and their sum. The call on scan-range returns a series of all the even natural numbers. However, since no elements beyond the first five are ever used, no elements beyond the first five are ever computed.

      (let ((x (subseries (scan-range :from 0 :by 2) 0 5))) 
	(values (collect x) (collect-sum x))) 
	=> (0 2 4 6 8) and 20
      

Like sequences and unlike streams, a series is not altered when its elements are accessed. For instance, both users of x above receive the same elements.

This differs from the original version. The following changes were made:

To install, just untar it somewhere, compile s-package.lisp and s-code.lisp and load them in that order. Then run (series::install) to install in the current Lisp package. Compile and load s-tests.lisp and then run (do-tests) to run the tests.

Alternatively, if you have Mark Kantrowitz's defsystem, you can use the supplied defsystem files to compile and load the two pieces. Be sure to change the paths in the defsystem files to match your installation.

You should not get many errors. Here are the results from different implementations:

CMUCL (post 18b)
8 out of 552 total tests failed: 294, 319, 381, 382, 383, 427, 428, 429. These failures appear to be bugs in the byte-code interpreter, which is known to be much buggier than the compiler.
CLISP
No tests failed, in ANSI mode (clisp -a). Otherwise tests 200, 201, and 203 fail.
ACL 5.0 (Linux)
Harlequin Lispworks (Windows Personal Edition 4.1)
No tests failed!

Hope you find this useful.


Raymond Toy
Last modified: Fri Jul 2 16:49:45 EDT 1999