纯函数
在计算机科学里,若一个函数符合以下要求,则它可能被认为是纯函数:
纯函数的输出可以不用和所有的输入值有关,甚至可以和所有的输入值都无关。但纯函数的输出不能和输入值以外的任何信息有关。纯函数可以传回多个输出值,但上述的原则需针对所有输出值都要成立。若引数是传引用调用,若有对参数对象的更改,就会影响函数以外对象的内容,因此就不是纯函数。
单词 | Pure function |
释义 |
Pure function
中文百科
纯函数在计算机科学里,若一个函数符合以下要求,则它可能被认为是纯函数: 纯函数的输出可以不用和所有的输入值有关,甚至可以和所有的输入值都无关。但纯函数的输出不能和输入值以外的任何信息有关。纯函数可以传回多个输出值,但上述的原则需针对所有输出值都要成立。若引数是传引用调用,若有对参数对象的更改,就会影响函数以外对象的内容,因此就不是纯函数。
英语百科
Pure function 纯函数In computer programming, a function may be considered a pure function if both of the following statements about the function hold: The result value need not depend on all (or any) of the argument values. However, it must depend on nothing other than the argument values. The function may return multiple result values and these conditions must apply to all returned values for the function to be considered pure. If an argument is call by reference, any parameter mutation will alter the value of the argument outside the function, which will render the function impure. |
随便看 |
|
英汉网英语在线翻译词典收录了3779314条英语词汇在线翻译词条,基本涵盖了全部常用英语词汇的中英文双语翻译及用法,是英语学习的有利工具。