From WolframAlpha: http://mathworld.wolfram.com/Function.html "While this notation is deprecated by professional mathematicians, it is the more familiar on开发者_高级运维e for most nonprofessionals. Therefore, unless indicated otherwise by context, the notation is taken in this work to be a shorthand for the more rigorous ."
Referring to f(x)
being deprecated in favor of f:x->f(x)
.
I thought this was interesting because I've been familiar with:
function name(arg)
In all my years of middle school through high school, I have never seen functions with any other notation, what is the benefit of using f:x->f(x)
instead of f(x)
? If f(x)
really is deprecated, why do programming languages continue to use a similar syntax?
You're taking the quote out of context. The page says "However, especially in more introductory texts, the notation f(x) is commonly used to refer to the function f itself (as opposed to the value of the function evaluated at x). In this context, the argument x is considered to be a dummy variable whose presence indicates that the function f takes a single argument (as opposed to f(x,y), etc.)" and then says that that's what deprecated.
In most programming languages f(x)
refers to the function f
evaluated with the argument x
and writing f(x)
when x
is not defined is an error. So they don't use f(x)
in its deprecated sense.
To refer to the function f
itself, you'd use just f
or lambda x: f(x)
or something similar depending on the programming language.
精彩评论