Try to implement the below code in R programming:
curve(dnorm(x, mean = 2), from = -3, to = 3)
The above curve function watches for the xname= variable (defaults to x) in the function call, so in dnorm(x, mean=2), it is not able to refer to an x in the calling environment, it is a placeholder for the curve to use for repeated values.
The reason plot(dnorm, ...) works because of the presence of graphics::plot.function, since dnorm in our case, is a function. When you have tried to execute the plot(dnorm(mean=2)), the dnorm(mean=2) will no longer a function, it is a call ... that happens to fail because it requires x (its first argument) be provided.