Pure Functional Programming

Pure Functional Programming
复制标题

纯函数式编程

DOI:
--
复制
发表时间:
2017
期刊:
影响因子:
--
通讯作者:
T. Mailund
T. Mailund
中科院分区:
--
文献类型:
--
作者:
T. Mailund

文献摘要

被引文献

相似文献

纯函数是一种行为类似于数学函数的函数:它将值从一个空间映射到另一个空间,相同的值总是映射到相同的结果,并且在数学函数中没有副作用。编程语言在确保函数纯粹性方面的水平各不相同,R在这方面做得很少。因为值是不可变的,所以您可以保证函数可能具有哪些副作用,但不是很多。但是,您可以通过仔细的编程来确保这一点。
A pure function is a function that behaves like a mathematical function: it maps values from one space to another, the same value always maps to the same result, and there is no such thing as a side effect in a mathematical function. The level to which programming languages go to ensure that functions are pure varies, and R does precious little in this regard. Because values are immutable, you have some guarantee about which side effects functions can have, but not much. You can ensure it through careful programming, however.