24
$\begingroup$

Is there a list of all symbols with special display forms but no built-in meaning? That is, operators that are described in the tutorial Operators without Built-in Meanings?

$\endgroup$
22
$\begingroup$

Updated to include both unary and binary operators

One idea is to use the usage message of a symbol as a clue that it has a special display form, probably with no built-in meaning. For example:

?TildeTilde

tildetilde

The following 2 functions check the usage message of a symbol to see if it contains "displays as" or "formats as", and then weeds out those symbols where the display boxes of the unary or binary operator indicates that it is a built-in symbol.

binaryQ[str_] := Module[
    {usage=ToExpression[str, InputForm, Function[x, MessageName[x, "usage"], HoldAll]]},

    If[!StringQ[usage]||StringFreeQ[usage,"displays as" | "formats as"], Return[False]];
    With[{sym=Symbol[str]},
        str =!= "EmbeddedHTML" &&
        FreeQ[
            MakeBoxes[sym[a,b]],
            PaneSelectorBox|TagBox|str|DynamicBox|PaneBox|PanelBox|InterpretationBox|DynamicWrapperBox
        ]
    ]
]

unaryQ[str_] := Module[
    {usage=ToExpression[str, InputForm, Function[x, MessageName[x, "usage"], HoldAll]]},

    If[!StringQ[usage]||StringFreeQ[usage,"displays as" | "formats as"],Return[False]];
    With[{sym=Symbol[str]},
        str=!="Defer" &&
        FreeQ[
            MakeBoxes[sym[a]],
            StyleBox|PaneSelectorBox|TagBox|str|DynamicBox|PaneBox|PanelBox
        ]
    ]
]

Here is the list of symbols created using the above predicate:

unaryOps = Cases[Names["*"], s_?unaryQ]

{"AngleBracket", "BracketingBar", "CapitalDifferentialD", "CircleTimes", "Coproduct", "Del", "DifferentialD", "DoubleBracketingBar", "MinusPlus", "PlusMinus", "Square", "SubMinus", "SubPlus", "SubStar", "SuperDagger", "SuperMinus", "SuperPlus", "SuperStar"}

binaryOps = Cases[Names["*"], s_?binaryQ]

{"AngleBracket", "Backslash", "Because", "BracketingBar", "Cap", "CenterDot", "CircleDot", "CircleMinus", "CirclePlus", "CircleTimes", "Colon", "Congruent", "Coproduct", "Cup", "CupCap", "Diamond", "DotEqual", "DoubleBracketingBar", "DoubleDownArrow", "DoubleLeftArrow", "DoubleLeftRightArrow", "DoubleLeftTee", "DoubleLongLeftArrow", "DoubleLongLeftRightArrow", "DoubleLongRightArrow", "DoubleRightArrow", "DoubleRightTee", "DoubleUpArrow", "DoubleUpDownArrow", "DoubleVerticalBar", "DownArrow", "DownArrowBar", "DownArrowUpArrow", "DownLeftRightVector", "DownLeftTeeVector", "DownLeftVector", "DownLeftVectorBar", "DownRightTeeVector", "DownRightVector", "DownRightVectorBar", "DownTee", "DownTeeArrow", "EqualTilde", "Equilibrium", "GreaterEqualLess", "GreaterFullEqual", "GreaterGreater", "GreaterLess", "GreaterTilde", "HumpDownHump", "HumpEqual", "LeftArrow", "LeftArrowBar", "LeftArrowRightArrow", "LeftDownTeeVector", "LeftDownVector", "LeftDownVectorBar", "LeftRightArrow", "LeftRightVector", "LeftTee", "LeftTeeArrow", "LeftTeeVector", "LeftTriangle", "LeftTriangleBar", "LeftTriangleEqual", "LeftUpDownVector", "LeftUpTeeVector", "LeftUpVector", "LeftUpVectorBar", "LeftVector", "LeftVectorBar", "LessEqualGreater", "LessFullEqual", "LessGreater", "LessLess", "LessTilde", "LongLeftArrow", "LongLeftRightArrow", "LongRightArrow", "LowerLeftArrow", "LowerRightArrow", "MinusPlus", "NestedGreaterGreater", "NestedLessLess", "NotCongruent", "NotCupCap", "NotDoubleVerticalBar", "NotEqualTilde", "NotExists", "NotGreater", "NotGreaterEqual", "NotGreaterFullEqual", "NotGreaterGreater", "NotGreaterLess", "NotGreaterSlantEqual", "NotGreaterTilde", "NotHumpDownHump", "NotHumpEqual", "NotLeftTriangle", "NotLeftTriangleBar", "NotLeftTriangleEqual", "NotLess", "NotLessEqual", "NotLessFullEqual", "NotLessGreater", "NotLessLess", "NotLessSlantEqual", "NotLessTilde", "NotNestedGreaterGreater", "NotNestedLessLess", "NotPrecedes", "NotPrecedesEqual", "NotPrecedesSlantEqual", "NotPrecedesTilde", "NotReverseElement", "NotRightTriangle", "NotRightTriangleBar", "NotRightTriangleEqual", "NotSquareSubset", "NotSquareSubsetEqual", "NotSquareSuperset", "NotSquareSupersetEqual", "NotSubset", "NotSubsetEqual", "NotSucceeds", "NotSucceedsEqual", "NotSucceedsSlantEqual", "NotSucceedsTilde", "NotSuperset", "NotSupersetEqual", "NotTilde", "NotTildeEqual", "NotTildeFullEqual", "NotTildeTilde", "NotVerticalBar", "Overscript", "PlusMinus", "Precedes", "PrecedesEqual", "PrecedesSlantEqual", "PrecedesTilde", "Proportion", "Proportional", "ReverseElement", "ReverseEquilibrium", "ReverseUpEquilibrium", "RightArrow", "RightArrowBar", "RightArrowLeftArrow", "RightDownTeeVector", "RightDownVector", "RightDownVectorBar", "RightTee", "RightTeeArrow", "RightTeeVector", "RightTriangle", "RightTriangleBar", "RightTriangleEqual", "RightUpDownVector", "RightUpTeeVector", "RightUpVector", "RightUpVectorBar", "RightVector", "RightVectorBar", "ShortDownArrow", "ShortLeftArrow", "ShortRightArrow", "ShortUpArrow", "SmallCircle", "SquareIntersection", "SquareSubset", "SquareSubsetEqual", "SquareSuperset", "SquareSupersetEqual", "SquareUnion", "Star", "Subscript", "Subset", "SubsetEqual", "Succeeds", "SucceedsEqual", "SucceedsSlantEqual", "SucceedsTilde", "SuchThat", "Superset", "SupersetEqual", "Therefore", "Tilde", "TildeEqual", "TildeFullEqual", "TildeTilde", "Underscript", "UnionPlus", "UpArrow", "UpArrowBar", "UpArrowDownArrow", "UpDownArrow", "UpEquilibrium", "UpperLeftArrow", "UpperRightArrow", "UpTee", "UpTeeArrow", "Vee", "VerticalBar", "VerticalSeparator", "VerticalTilde", "Wedge"}

And, here is a table showing the display forms of the symbols:

Replace[
    unaryOps,
    s_String :> Tooltip[Symbol[s][a], s],
    {1}
] //Multicolumn[#, 5, Dividers->All]&

enter image description here

Replace[
    binaryOps,
    s_String :> Tooltip[Symbol[s][a,b],s],
    {1}
] //Multicolumn[#,10,Dividers->All]&

enter image description here

As @Mr. Wizard shows in his answer, there are other undocumented symbols that have special formatting.

$\endgroup$
  • $\begingroup$ looks like a syntax error no first argument to Function and you use a slot symbol with no & ? $\endgroup$ – george2079 May 31 '17 at 19:25
  • $\begingroup$ @george2079 It's not a syntax error, but it does look a bit odd. Function[, f[#]] is equivalent to f[#]&, you can use either Function or & but not both. I wanted to use the 3-arg version of Function to prevent an evaluation leak. Perhaps Function[Null, MessageName[#, "usage"], HoldAll] would have looked better. $\endgroup$ – Carl Woll May 31 '17 at 19:32
  • $\begingroup$ oh I see. I thought it was not working but its just because processing all of Names["*"] takes a while. $\endgroup$ – george2079 May 31 '17 at 19:43
  • $\begingroup$ @george2079 A related Q&A: (29168) $\endgroup$ – Mr.Wizard May 31 '17 at 21:01
  • $\begingroup$ Carl, is this list expected to be exhaustive? Do all such operators have a usage message? $\endgroup$ – Mr.Wizard May 31 '17 at 21:03
9
$\begingroup$

Here is an approach based on reading the Front End resource UnicodeCharacters.tr.

This method finds some operators that do not presently appear in Carl Woll's list including documented operators CapitalDifferentialD, DifferentialD, and Square, and runs much more quickly. However it also misses the bracketing operators i.e. AngleBracket, BracketingBar, DoubleBracketingBar.

ucharTR = ReadList[System`Dump`unicodeCharactersTR, Word, RecordLists -> True];

operators = 
  Cases[ucharTR, {_, ch_, ___, "Infix" | "Prefix" | "Postfix"(*|"InfixOpen"|"Open"|
      "Close"*), ___} :> StringTake[ch, {3, -2}]] /. "" -> Sequence[];

free =
  operators //
   Select[
    Module[{syms, msg},
      syms = 
       Rest @ Cases[MakeExpression["a\\[" <> # <> "\]b", StandardForm], 
         Except[HoldPattern[a | b | Times | Plus], _Symbol], {-1}, Heads -> True];
      msg = Quiet[MessageName[#, "usage"] & @@ syms];
      syms =!= {} && (! StringQ[msg] || StringContainsQ[msg, " displays as "])
    ] &
   ];

Extra operators my method finds:

Complement[free, undefined]
{"CapitalDifferentialD", "DifferentialD", "ExpectationE", 
 "InvisiblePostfixScriptBase", "InvisiblePrefixScriptBase", "Perpendicular",
 "ProbabilityPr", "RoundImplies", "Square"}

Operators my method misses:

Complement[undefined, free]
{"AngleBracket", "BracketingBar", "DoubleBracketingBar"}
$\endgroup$
  • $\begingroup$ "CapitalDifferentialD", "DifferentialD", "ExpectationE", "ProbabilityPR", "InvisiblePostfixScriptBase", "InvisiblePrefixScriptBase" and "Square" are all unary operators, and I purposely excluded them (I was interested in binary operators, even though I didn't specify that in my OP). "RoundImplies" seems to have a spurious MakeBoxes rule that disables formatting. "Perpendicular" does have a display form. Note that "ExpectationE", "ProbabilityPR", "RoundImplies", "InvisiblePostfixScriptBase", "InvisiblePrefixScriptBase" and "Perpendicular" are undocumented, so probably shouldn't use them. $\endgroup$ – Carl Woll May 31 '17 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.