Skip to main content
added 1430 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49

E.g.Consider an operator form of the pangram: "Illustrate

"Illustrate the quick brown fox jumping over the lazy dog" 

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

or a variation involving more "Center Embedding" a linguistic analog of the quick brown fox jumping overprogressive enveloping of {"f","h","p","r"}

"Illustrate the fox, the cat the dog the flea bit crippled fought jumping over the lazy dog."

which seems difficult to parse possibly due to limitations in human's short-term memory as we long for a bottoming out to attach subjects to their matching predicates. Alternatively

Illustrate @* Fox$_{(the, quick,\ brown,\ fought\ by\ cat_{crippled \ by\ dog_{bitten\ by\ flea}})}$ @* JumpingOver @* Dog$_{(the, lazy)}$

seems more parseable. These involve more descriptive forms than operational (but the lazy dog"same principle applies) but more operational forms also come in variable order linguistically. Consider

"Illustrate the quick brown fox jumping over the lazy dog and exhibit by first performing gilded framing and then sending to the Louvre by rail."

which when put together in "operator form" expresses:

(Illustrate @* Fox$_{(the, quick,brown)}$$_{(the, quick,\ brown,\ fought\ by\ cat_{crippled \ by\ dog_{bitten\ by\ flea}})}$ @* JumpingOver @* Dog$_{(the, lazy)}$) // Frame$_{guilded}$ // Send$_{rail}$ // Exhibit$_{Louvre}$

Naturally this could all be enhanced by flexible code-folding (and say tool-tip illustration of the structural change performed by the operator) but the point is it becomes more natural (possible?) with operator form positioning. It also indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

E.g. an operator form of the pangram: "Illustrate the quick brown fox jumping over the lazy dog"

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

Consider an operator form of the pangram:

"Illustrate the quick brown fox jumping over the lazy dog" 

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

or a variation involving more "Center Embedding" a linguistic analog of the progressive enveloping of {"f","h","p","r"}

"Illustrate the fox, the cat the dog the flea bit crippled fought jumping over the lazy dog."

which seems difficult to parse possibly due to limitations in human's short-term memory as we long for a bottoming out to attach subjects to their matching predicates. Alternatively

Illustrate @* Fox$_{(the, quick,\ brown,\ fought\ by\ cat_{crippled \ by\ dog_{bitten\ by\ flea}})}$ @* JumpingOver @* Dog$_{(the, lazy)}$

seems more parseable. These involve more descriptive forms than operational (but the same principle applies) but more operational forms also come in variable order linguistically. Consider

"Illustrate the quick brown fox jumping over the lazy dog and exhibit by first performing gilded framing and then sending to the Louvre by rail."

which when put together in "operator form" expresses:

(Illustrate @* Fox$_{(the, quick,\ brown,\ fought\ by\ cat_{crippled \ by\ dog_{bitten\ by\ flea}})}$ @* JumpingOver @* Dog$_{(the, lazy)}$) // Frame$_{guilded}$ // Send$_{rail}$ // Exhibit$_{Louvre}$

Naturally this could all be enhanced by flexible code-folding (and say tool-tip illustration of the structural change performed by the operator) but the point is it becomes more natural (possible?) with operator form positioning. It also indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

deleted 6 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* -> {   <|"f" -> 6, "g" -> 7, "h" -> 8|>8, <|"p""p" -> 16, "q" -> 17, "r" -> 18|>} *)
Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

 (* -> {  <|"f" -> 6, "g" -> 7, "h" -> 8|>8, <|"p""p" -> 16, "q" -> 17, "r" -> 18|>} *)
Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

 (* -> {   <|"f" -> 6, "g" -> 7, "h" -> 8|>8, <|"p""p" -> 16, "q" -> 17, "r" -> 18|>} *)

(* not actual input/output speculative only *)
{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* ->   {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)
Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)
Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)
Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

(* not actual input/output speculative only *)
{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* -> {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)
Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* ->    <|"f" -> 6, "g" -> 7, "h" -> 8, "p" -> 16, "q" -> 17, "r" -> 18|> *)
Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

 (* ->   <|"f" -> 6, "g" -> 7, "h" -> 8, "p" -> 16, "q" -> 17, "r" -> 18|> *)
Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

 (* ->    <|"f" -> 6, "g" -> 7, "h" -> 8, "p" -> 16, "q" -> 17, "r" -> 18|> *)

(* not actual input/output speculative only *)
{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* ->   {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)
added 3 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49

Here's a stab at a second pass: Syntactic sugar shouldn't be underestimated given its cumulative effects (also only a limited number of functions can have shortforms and sometimes for precedence reasons four symbols are needed in the pure form - (#)&)

An example: Suppose it is desired to take keys/values "f" through to "h" and "p" through to "r" in assoc3, an association that associates the nth letter of the alphabet with the number n.

assoc3 = AssociationThread[CharacterRange["a", "z"] -> Range@26];

One solution

Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

has a natural object being "operated on", {"f","h","p","r"} being pushed deeper into the code and possibly not as clear as using operator forms:

Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

or something where operator forms are potentially extended to all functions and to include shortform versions

Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

(* not actual input/output speculative only *)

At a more abstract level operator forms seem to be a way for harnessing context in that omitted arguments are being supplied by the object being operated on. There are however some functions that surprisingly don't seem to have operator forms:

{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* -> {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)

or that don't operate in certain situations

{Query["Min" -> Min][{1, 2, 3}], Query["Min" -> Min@# &][{1, 2, 3}]}
(* -> {{1, 2, 3}, "Min" -> 1} *)

suggesting the advantages of automating the process of detecting operator forms since this seems closer to the way humans linguistically operate

E.g. an operator form of the pangram: "Illustrate the quick brown fox jumping over the lazy dog"

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

Here's a stab at a second pass: Syntactic sugar shouldn't be underestimated given its cumulative effects (also only a limited number of functions can have shortforms and sometimes for precedence reasons four symbols are needed in the pure form - (#)&)

An example: Suppose it is desired to take keys/values "f" through to "h" and "p" through to "r" in assoc3, an association that associates the nth letter of the alphabet with the number n.

assoc3 = AssociationThread[CharacterRange["a", "z"] -> Range@26];

One solution

Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

has a natural object being "operated on", {"f","h","p","r"} being pushed deeper into the code and possibly not as clear using operator forms:

Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

or something where operator forms are potentially extended to all functions and to include shortform versions

Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

(* not actual input/output speculative only *)

At a more abstract level operator forms seem to be a way for harnessing context in that omitted arguments are being supplied by the object being operated on. There are however some functions that surprisingly don't seem to have operator forms:

{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* -> {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)

or that don't operate in certain situations

{Query["Min" -> Min][{1, 2, 3}], Query["Min" -> Min@# &][{1, 2, 3}]}
(* -> {{1, 2, 3}, "Min" -> 1} *)

suggesting the advantages of automating the process of detecting operator forms since this seems closer to the way humans linguistically operate

E.g. an operator form of the pangram: "Illustrate the quick brown fox jumping over the lazy dog"

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

Here's a stab at a second pass: Syntactic sugar shouldn't be underestimated given its cumulative effects (also only a limited number of functions can have shortforms and sometimes for precedence reasons four symbols are needed in the pure form - (#)&)

An example: Suppose it is desired to take keys/values "f" through to "h" and "p" through to "r" in assoc3, an association that associates the nth letter of the alphabet with the number n.

assoc3 = AssociationThread[CharacterRange["a", "z"] -> Range@26];

One solution

Merge[Query[Apply[Span,Partition[Flatten[Map[FirstPosition[Keys@assoc3,#]&,{"f","h","p","r"}]],2],{1}]][assoc3],First]

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

has a natural object being "operated on", {"f","h","p","r"} being pushed deeper into the code and possibly not as clear as using operator forms:

Merge[First]@*(Query[#][assoc3] &)@*(Span@@@#&)@*(Partition[#, 2]&)@*Flatten@((FirstPosition[Keys@assoc3,#]&)/@{"f","h","p","r"})

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

or something where operator forms are potentially extended to all functions and to include shortform versions

Merge[First]@*Query[][assoc3]@*Span@@@ @*Partition[2]@*Flatten@*FirstPosition[Keys@assoc3]/@{"f","w","s","w"}

(* -> {<|"f" -> 6, "g" -> 7, "h" -> 8|>, <|"p" -> 16, "q" -> 17, "r" -> 18|>} *)

(* not actual input/output speculative only *)

At a more abstract level operator forms seem to be a way for harnessing context in that omitted arguments are being supplied by the object being operated on. There are however some functions that surprisingly don't seem to have operator forms:

{Query[Sort[Greater]][{1, 2, 3}], Query[Sort[#, Greater] &][{1, 2, 3}]}
(* -> {Sort[Greater][{1, 2, 3}], {3, 2, 1}} *)

or that don't operate in certain situations

{Query["Min" -> Min][{1, 2, 3}], Query["Min" -> Min@# &][{1, 2, 3}]}
(* -> {{1, 2, 3}, "Min" -> 1} *)

suggesting the advantages of automating the process of detecting operator forms since this seems closer to the way humans linguistically operate

E.g. an operator form of the pangram: "Illustrate the quick brown fox jumping over the lazy dog"

Illustrate @* Fox$_{(the, quick,brown)}$ @* JumpingOver @* Dog$_{(the, lazy)}$

indicates a possible bridging between the linguistic but (destined?) vagueness of wolfram-alpha queries and the precision but non-linguistic form of the Wolfram Language (at least initially in restricted domains)

deleted 17 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
deleted 2 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
added 90 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
deleted 1 character in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
added 2258 characters in body
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading
Source Link
Ronald Monson
  • 6.1k
  • 29
  • 49
Loading