How to replace failure by a list of successes a method for exception handling, backtracking, and pattern matching in lazy functional languages
- Philip Wadler
- … show all 1 hide
Purchase on Springer.com
$29.95 / €24.95 / £19.95*
* Final gross prices may vary according to local VAT.
Should special features for exception handling, backtracking, or pattern matching be included in a programming language? This paper presents a method whereby some programs that use these features can be re-written in a functional language with lazy evaluation, without the use of any special features. This method may be of use for practicing functional programmers; in addition, it provides further evidence of the power of lazy evaluation. The method itself is straightforward: each term that may raise an exception or backtrack is replaced by a term that returns a list of values. In the special case of pattern matching without backtracking, the method can be applied even if lazy evaluation is not present. The method should be suitable for applications such as theorem proving using tacticals, as in ML/LCF.
- Aho, A. V., and Ullman, J. D. Principles of Compiler Design. Addison-Wesley, 1977.
- Black, A. P. Exception handling: the case against. D. Phil. dissertation, Oxford University, 1982. Also available as University of Washington technical report TR 82-01-02, 1982.
- Bobrow, D. G., and Raphael, B. New programming languages for artificial intelligence research. Computing Surveys, 6(3): 155–174, September 1974.
- Friedman, D. P., and Wise, D. S. Cons should not evaluate its arguments. In Michaelson and Milner (editors), Automata, Languages, and Programming, 257–284, Edinburgh University Press, 1976.
- Gordon, M. J., Milner, R., and Wadsworth, C. P. Edinburgh LCF. Lecture Notes in Computer Science 78. Springer-Verlag, 1979.
- Griswold, R. E. The evaluation of expressions in Icon. ACM Transactions on Programming Languages and Systems, 4(4): 563–584, October 1982.
- Griswold, R. E. The evaluation of expressions in Icon. Symposium on Lisp and Functional Programming, ACM, Austin, TX, August 1984.
- Henderson, P., and Morris, J. H. A lazy evaluator. in 3'rd Symposium on Principals of Programming Languages, 95–103, ACM, Atlanta, GA, 1976.
- Henderson, P. Functional Programming: Application and Implementation. Prentice-Hall, 1980.
- Kowalski, R. Algorithm = Logic + Control. Communications of the ACM, 22(7), July, 1979.
- Morris, J. H., Schmidt, E., and Wadler, P. L. Experience with an applicative string processing language. 7'th Symposium on Principles of Programming Languages, ACM, Las Vegas, Nevada, 1980.
- Rewriting in Cambridge LCF. Science of Computer Programming, 3: 119–149, Sept., 1983.
- Turner, D. A. Recursion equations as a programming language. In Darlington, et al (editors), Functional Programming and Its Applications, Cambridge University Press, 1981.
- Wadler, P. L. A splitting headache: Strict vs. lazy semantics for pattern matching in lazy functional languages. To appear.
- How to replace failure by a list of successes a method for exception handling, backtracking, and pattern matching in lazy functional languages
- Book Title
- Functional Programming Languages and Computer Architecture
- Book Subtitle
- Nancy, France, September 16–19, 1985
- pp 113-128
- Print ISBN
- Online ISBN
- Series Title
- Lecture Notes in Computer Science
- Series Volume
- Series ISSN
- Springer Berlin Heidelberg
- Copyright Holder
- Additional Links
- Industry Sectors
- eBook Packages
To view the rest of this content please follow the download PDF link above.