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 down valuesDownValues
(and more rarely up values and sub values;SubValues
; symbols with sub valuesSubValues
would more commonly be referred to as operators), whereas symbols with own valuesOwnValues
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 a down valuean 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 own valuesOwnValues
, up valuesUpValues
, or sub valuesSubValues
, though. Not just downvaluesDownValues
.