Skip to main content
added 24 characters in body
Source Link
C. E.
  • 71.2k
  • 6
  • 141
  • 269

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.

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 values (and more rarely up values and sub values; symbols with sub values would more commonly be referred to as operators), whereas symbols with own values 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 value.

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 values, up values, or sub values, though. Not just downvalues.

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.

deleted 8 characters in body
Source Link
C. E.
  • 71.2k
  • 6
  • 141
  • 269

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 downvaluesdown values (and more rarely upvaluesup values and subvalues;sub values; symbols with subvaluessub values would more commonly be referred to as operators), whereas symbols with ownvaluesown values 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 downvaluedown value.

Perhaps the distinction that you are looking for is that f[5] is that 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 trueTrue if the expression will be transformed by ownvaluesown values, up values, or sub values, though. Not just downvalues.

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 upvalues 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 a downvalue.

Perhaps the distinction that you are looking for is that f[5] is that 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, though. Not just downvalues.

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 values (and more rarely up values and sub values; symbols with sub values would more commonly be referred to as operators), whereas symbols with own values 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 value.

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 values, up values, or sub values, though. Not just downvalues.

Source Link
C. E.
  • 71.2k
  • 6
  • 141
  • 269

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 upvalues 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 a downvalue.

Perhaps the distinction that you are looking for is that f[5] is that 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, though. Not just downvalues.