When is a functional program not a functional program?

When is a functional program not a functional program?
复制标题

什么时候函数式程序不是函数式程序?

DOI:
--
复制
发表时间:
1999
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
通讯作者:
J. Longley
J. Longley
中科院分区:
--
文献类型:
--
作者:
J. Longley

文献摘要

被引文献

相似文献

在不纯函数式语言中,有些程序的行为完全是函数式的(因为它们对输入进行扩展),但它们计算的函数不能用语言的纯函数式片段编写。也就是说,具有函数行为的程序类比通常的纯函数程序类更具表达性。在本文中,我们通过标准ML中的示例来介绍这类扩展的“函数式”程序,并探讨它们可能为程序员和语言实现者提供的内容。在回顾了一些理论背景之后,我们给出了上述类型的函数的一些示例,并讨论了它们如何实现。然后,我们考虑这些功能的两种可能的编程应用:搜索算法的实现,以及精确实数积分的算法。我们讨论了这种风格的编程相对于其他方法的优点和局限性。我们还考虑了这些函数将提供的编译器优化的增加范围。
In an impure functional language, there are programs whose behaviour is completely functional (in that they behave extensionally on inputs), but the functions they compute cannot be written in the purely functional fragment of the language. That is, the class of programs with functional behaviour is more expressive than the usual class of pure functional programs. In this paper we introduce this extended class of "functional" programs by means of examples in Standard ML, and explore what they might have to offer to programmers and language implementors.After reviewing some theoretical background, we present some examples of functions of the above kind, and discuss how they may be implemented. We then consider two possible programming applications for these functions: the implementation of a search algorithm, and an algorithm for exact real-number integration. We discuss the advantages and limitations of this style of programming relative to other approaches. We also consider the increased scope for compiler optimizations that these functions would offer.