Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Note this post was generated (and adapted) from a notebook as part of road-testing a developing markdownmarkdown - hence its formatting may be less than optimal. It's also long.

V10.3.1 provides functionality for viewing all built-in operator forms (via so-called Curryable symbols) weighted here according to SE usage (bearing in mind that most of this predates operator form's introduction). [See[See also other listings]listings].

  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= code although there are certain advantagesadvantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functional scope.

The importance of the Wolfram Language's immutability in rapid development and experimentation hashas been well-documentedwell-documented and in this context manifests through operator forms' ability to create new structures each time they are applied - thereby leaving untouched underlying definitions. When such underlying definitions do need to be changed/augmentation (say following a period of experimentation/prototyping) then all this operator form functionality can again be harnessed this time by an operator-form of Set(most naturally via an infix operator akin to @=, as previously advocatedadvocated).

Note this post was generated (and adapted) from a notebook as part of road-testing a developing markdown - hence its formatting may be less than optimal. It's also long.

V10.3.1 provides functionality for viewing all built-in operator forms (via so-called Curryable symbols) weighted here according to SE usage (bearing in mind that most of this predates operator form's introduction). [See also other listings].

  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= code although there are certain advantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functional scope.

The importance of the Wolfram Language's immutability in rapid development and experimentation has been well-documented and in this context manifests through operator forms' ability to create new structures each time they are applied - thereby leaving untouched underlying definitions. When such underlying definitions do need to be changed/augmentation (say following a period of experimentation/prototyping) then all this operator form functionality can again be harnessed this time by an operator-form of Set(most naturally via an infix operator akin to @=, as previously advocated).

Note this post was generated (and adapted) from a notebook as part of road-testing a developing markdown - hence its formatting may be less than optimal. It's also long.

V10.3.1 provides functionality for viewing all built-in operator forms (via so-called Curryable symbols) weighted here according to SE usage (bearing in mind that most of this predates operator form's introduction). [See also other listings].

  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= code although there are certain advantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functional scope.

The importance of the Wolfram Language's immutability in rapid development and experimentation has been well-documented and in this context manifests through operator forms' ability to create new structures each time they are applied - thereby leaving untouched underlying definitions. When such underlying definitions do need to be changed/augmentation (say following a period of experimentation/prototyping) then all this operator form functionality can again be harnessed this time by an operator-form of Set(most naturally via an infix operator akin to @=, as previously advocated).

fixed grammar, inserted correct function names
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49

The consistency involved in omitting a "fixed structure" in the operator form adds greatly to the idiom's pedagogy (which IMO makes the implementation of DatabinAdd a mistake [unless, I've possibly missed a compelling use-case justifying such a violation]) but even "second best" operator forms can still be useful. Take MemberQ as an example:

enter image description hereenter image description here

Note that almost all system-defined operator forms contain a single argument and in the rare cases where two-arguments are used (MapAt, ReplaceInsert, Entity) their corresponding canonical form always contain three or more arguments. Hence, to avoid ambiguity, the number of arguments in an operator form apparently always needs to be less than the canonical usage. As a consequence, operators forms become restricted to this canonical usage (currying is a slight misnomer here as it is more accurately an example of partial function application although admittedly partialfunctioning doesn't quite have the same ring) .

(1) is used for simplicity in the above examples but is not so clean (n.b. also Sort and SortBy), (2) is useful for the most common operator forms (as per the first collage in the updated question, it is no accident the most fundamental/popular functions Map, Apply and ReplaceAll all had their own (short-form) "operator forms" long before V10 arrived) whereas the constant naming in (3) seems the only sustainable solution. Clearly such heuristics can advantageously consist of typing and pattern-matching but for mine the most interesting and promising avenue involves incorporating context to the same extent as routinely occurs with natural language interpretation.

The natural language in Wolfram Alpha still seems too imprecise to be reliably intermingled with Wolfram Language while the latter's precision works tends to mitigate against opening spaces for flexibility and fruitful ambiguity. Operator forms perhaps offer a case study/benchmark for how these might be effectively coalesced.

The consistency involved in omitting a "fixed structure" in the operator form adds greatly to the idiom's pedagogy (which IMO makes the implementation of DatabinAdd a mistake [unless, I've possibly missed a compelling use-case justifying such a violation]) but even "second best" operator forms can still be useful. Take MemberQ as an example:

enter image description here

Note that almost all system-defined operator forms contain a single argument and in the rare cases where two-arguments are used (MapAt, Replace, Entity) their corresponding canonical form always contain three or more arguments. Hence, to avoid ambiguity, the number of arguments in an operator form apparently always needs to be less than the canonical usage. As a consequence, operators forms become restricted to this canonical usage (currying is a slight misnomer here as it is more accurately an example of partial function application although admittedly partialfunctioning doesn't quite have the same ring) .

(1) is used for simplicity in the above examples but is not so clean (n.b. also Sort and SortBy), (2) is useful for the most common operator forms (as per the first collage in the updated question, it is no accident the most fundamental/popular functions Map, Apply and ReplaceAll all had their own (short-form) "operator forms" long before V10 arrived) whereas the constant naming in (3) seems the only sustainable solution. Clearly such heuristics can advantageously consist of typing and pattern-matching but for mine the most interesting and promising avenue involves incorporating context to the same extent as routinely occurs with natural language interpretation.

The natural language in Wolfram Alpha still seems too imprecise to be reliably intermingled with Wolfram Language while the latter's precision works tends to mitigate against opening spaces for flexibility and fruitful ambiguity. Operator forms perhaps offer a case study/benchmark for how these might be effectively coalesced.

The consistency involved in omitting a "fixed structure" in the operator form adds greatly to the idiom's pedagogy (which IMO makes the implementation of DatabinAdd a mistake [unless I've missed a compelling use-case justifying such a violation]) but even "second best" operator forms can still be useful. Take MemberQ as an example:

enter image description here

Note that almost all system-defined operator forms contain a single argument and in the rare cases where two-arguments are used (MapAt, Insert, Entity) their corresponding canonical form always contain three or more arguments. Hence, to avoid ambiguity, the number of arguments in an operator form apparently always needs to be less than the canonical usage. As a consequence, operators forms become restricted to this canonical usage (currying is a slight misnomer here as it is more accurately an example of partial function application although admittedly partialfunctioning doesn't quite have the same ring) .

(1) is used for simplicity in the above examples but is not so clean (n.b. also Sort and SortBy), (2) is useful for the most common operator forms (as per the first collage, it is no accident the most fundamental/popular functions Map, Apply and ReplaceAll all had their own (short-form) "operator forms" long before V10 arrived) whereas the constant naming in (3) seems the only sustainable solution. Clearly such heuristics can advantageously consist of typing and pattern-matching but for mine the most interesting and promising avenue involves incorporating context to the same extent as routinely occurs with natural language interpretation.

The natural language in Wolfram Alpha still seems too imprecise to be reliably intermingled with Wolfram Language while the latter's precision tends to mitigate against opening spaces for flexibility and fruitful ambiguity. Operator forms perhaps offer a case study/benchmark for how these might be effectively coalesced.

deleted 7 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= exprcode although there are certain advantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functifunctional scope.

  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= expr although there are certain advantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functi.

  • A more direct implementation involving subvalues head[_argsH___,argsT__][fx_]:= code although there are certain advantages for the more general idiom shown.

  • fx, is typically the first argument called (i.e. argsH typically matches the empty sequence) in system functions with the notable exceptions of MapAt, Insertand Entity.

  • The operator form typically consists of a single argument (with exceptions at the same functions just mentioned).

  • Here the operator form ohead is distinguished from the canonical form head to ensure their disambiguation although built-in operator forms avoid this by limiting their functional scope.

deleted 7 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading