WL terminology: evaluate, call, invoke, use, etc

A WL (Mma) program is a sequence of expressions to be evaluated, which generally involves applying commands and functions to actual arguments.

A program in Mathematica is a sequence of expression evaluations, period. A "function" or "command" is a replacement rule:

f[x_] := x
DownValues[f]

{HoldPattern[f[x_]] :> x}

Instead of f[x_] := x; f[5] we might just as well write f[5] /. f[x_] :> x. Both user-defined "functions" and "built-in functions" work in this way. Replacement rules, functions, and commands are all the same thing.

What is the distinction between DownValues, UpValues, SubValues, and OwnValues? shows that there are several different ways to attach replacement rules to symbols. "Functions" and "commands" is what we would say about symbols with DownValues (and more rarely up values and SubValues; symbols with SubValues would more commonly be referred to as operators), whereas symbols with OwnValues would be called variables.

I think it is justified to call f a function (or command) whether it appears in the context f[5] or Map[f, {1,2,3]. In both cases, f represents a symbol with an entry in DownValues[f].

Perhaps the distinction that you are looking for is that f[5] evaluates to something else, whereas f by itself does not. ValueQ exists to check if this is the case. Note that ValueQ will also return True if the expression will be transformed by OwnValues, UpValues, or SubValues, though. Not just DownValues.


I think that in Mathematica, symbols, expressions, evaluation and substitution rules are fundamental terms.

One writes an expression, sends it to the Mathematica kernel, kernel evaluates the expression (i.e. applies all relevant substitution rules) and returns the resulting expression.

For example, one may write f1[x,y]. This is just an expression with head f1 and two parts x and y, where f1, x, and y are all symbols. Square brackets are just a notation to distinguish parts from the head. If there is only one part one may use f1@x instead of the brackets.

One may define a substitution rule for symbol f1. For example:

f1[_Real, _Real]:=0

This instructs kernel to replace any sub-expression with head f1 and two real parts with 0 (another expression). However, if kernel encounters f1[1.0, 1.0, 1.0] or f1[a,b], no substitution will be made.

Very formally f1 is a symbol, which might induce a substitution when encountered as a head of subexpression during evaluation.

For simplicity, one calls f1 a function.

When f1[1.0, 1.0] gets substituted by 0 during evaluation, one may say that this is a function call.

In my experience, the term "function" is usually used for symbols which evaluate to numeric expression (i.e. Sin), while the term "command" is used for symbols which evaluate to some other expressions (i.e. Plot is substituted by Graphics)

There is no Callable in Mathematica, but there is an internal (undocumented) function to check if given expression might cause a substitution when used as a head:

System`Private`MightEvaluateWhenAppliedQ[f1]

True

This function can correctly identify pure functions as well:

System`Private`MightEvaluateWhenAppliedQ[(#) &]

True