File: series.html

package info (click to toggle)
series 19990702-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 456 kB
  • ctags: 962
  • sloc: lisp: 5,797; makefile: 47
file content (153 lines) | stat: -rw-r--r-- 5,477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>Lisp Series Package</title>
  </head>

  <body>
    <h1>What's New?</h1>

    <dl>
      <!-- one of (dd dt) -->
      <dt><a href="series-19990702.tar.gz">1999-07-02</a></dt>

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

      <dt><a href="series-19990415.tar.gz">1999-04-15</a></dt>

      <dd>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.
      </dd>

      <dt>1998-06-10</dt>

      <dd>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.</dd>
      <dt>1998-06-04</dt>

      <dd>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.</dd>
    </dl>

    <h1>Lisp Series Package</h1>

    This is my modified version of Richard Water's series package.
    For more information about this package, refer to Appendix A in <a
    href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html">Common
    Lisp the Language, 2nd Edition</a>.  This package is also
    described in two reports available.  Search for the reports <cite>AI Memo
    1082</cite> and <cite>AI Memo 1083</cite> on
    <a
    href="http://www.ai.mit.edu/publications/pubsDB/pubs-index.html">MIT AI Lab: Publications Database Search Results</a> 

    <p>
    The introduction says

    <blockquote>
      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.
      
      <pre>
      (collect-sum (choose-if #'plusp (scan '(1 -2 3 -4)))) => 4</pre>

      <p>
      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.
      </p>
      <pre>
      (let ((x (subseries (scan-range :from 0 :by 2) 0 5))) 
	(values (collect x) (collect-sum x))) 
	=> (0 2 4 6 8) and 20
      </pre>
      <p>
      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.
      </p>
    </blockquote>

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

    <ul>
      <li>Type declarations are generated better now, so that the
      compiler can optimize the resulting series expression
      better.</li>

      <li>Some clean up of the code to fix a few bugs and enhance
      portability.  In particular, the following systems are known to
      work:
	<ul>
	  <li>CMU Common Lisp</li>
	  <li>Allegro Common Lisp</li>
	  <li>Harlequin LispWorks</li>
	</ul>
      </li>
    </ul>


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

    <p>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. </p>

    <p>You should not get many errors.  Here are the results from
    different implementations:</p>
    <dl>
      <dt>CMUCL (post 18b)</dt>

      <dd>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.</dd>

      <dt>CLISP</dt>

      <dd>No tests failed, in ANSI mode (clisp -a).  Otherwise tests
      200, 201, and 203 fail.</dd>

      <dt>ACL 5.0 (Linux)</dt>
      <dd></dd>

      <dt>Harlequin Lispworks (Windows Personal Edition 4.1)</dt>

      <dd>No tests failed!</dd>
    </dl>


    <p>Hope you find this useful.</p>
    <hr>
    <address><a href="mailto:toy@rtp.ericsson.se">Raymond Toy</a></address>
<!-- Created: Mon Jun  1 12:31:07 EDT 1998 -->
<!-- hhmts start -->
Last modified: Fri Jul  2 16:49:45 EDT 1999
<!-- hhmts end -->
  </body>
</html>