How to Replace Failure by a List of Successes: A method for exception handling, backtracking, and pattern matching in lazy functional languages

How to Replace Failure by a List of Successes: A method for exception handling, backtracking, and pattern matching in lazy functional languages
复制标题

如何用成功列表替换失败:惰性函数语言中的异常处理、回溯和模式匹配方法

DOI:
10.1007/3-540-15975-4_33
复制
发表时间:
1985
期刊:
J. Funct. Program.
影响因子:
--
通讯作者:
Philip Wadler
Philip Wadler
中科院分区:
--
文献类型:
--
作者:
Philip Wadler

文献摘要

被引文献

相似文献

编程语言中是否应该包含异常处理、回溯或模式匹配的特殊功能?本文提出了一种方法,使一些程序,使用这些功能可以重新编写一个函数式语言与懒惰的评价,而不使用任何特殊功能。这种方法可能对实践函数式程序员有用;此外,它还提供了懒惰评估的力量的进一步证据。该方法本身很简单:每个可能引发异常或回溯的项都被返回值列表的项替换。在没有回溯的模式匹配的特殊情况下,即使不存在惰性评估,该方法也可以应用。该方法应该适用于使用策略的定理证明等应用,如ML/LCF。
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.