PURE VERSUS IMPURE LISP

Authors
Citation
N. Pippenger, PURE VERSUS IMPURE LISP, ACM transactions on programming languages and systems, 19(2), 1997, pp. 223-238
Citations number
15
Categorie Soggetti
Computer Sciences","Computer Science Software Graphycs Programming
ISSN journal
01640925
Volume
19
Issue
2
Year of publication
1997
Pages
223 - 238
Database
ISI
SICI code
0164-0925(1997)19:2<223:PVIL>2.0.ZU;2-1
Abstract
The aspect of purity versus impurity that we address involves the abse nce versus presence of mutation: the use of primitives (RPLACA and RPL ACD in Lisp, set-car! and set-cdr! in Scheme) that change the state of pairs without creating new pairs. It is well known that cyclic list s tructures can be created by impure Lisp, but not by pure Lisp. In this sense, impure Lisp is ''more powerful'' than pure Lisp. If the inputs and outputs are restricted to be sequences of atomic symbols, however , this difference in computability disappears. We show that if the tem poral sequence of input and output operations must be maintained (that is, if computations must be ''on-line''), then a difference in comple xity remains. We do this by comparing the power of pure and impure ''L isp machines.'' We show that what an impure Lisp machine does in n ste ps (executions of primitive operations), a pure Lisp machine can do in O(n log n) steps, and that in some cases n(n log n) steps are necessa ry.