Is there a comprehensive list of functions with operator forms?
Edit: version 11.0 update. Now it is superset of TypeSystem`$OperatorForms
. It now also includes operator forms that have different names than the functions they're currying, like EqualTo
.
One can find these functions in the documentation by keywords "operator form"
Select[Names@"*", StringMatchQ[ToString@ToExpression[# <> "::usage"],
"*operator form*"] &]
{"AllTrue", "AnyTrue", "Append", "Apply", "AssociationMap", \ "Between", "Cases", "CellularAutomaton", "ContainsAll", \ "ContainsAny", "ContainsExactly", "ContainsNone", "ContainsOnly", \ "Count", "CountDistinctBy", "CountsBy", "DatabinAdd", "Delete", \ "DeleteCases", "DeleteDuplicatesBy", "EqualTo", "Extract", \ "FeatureDistance", "FirstCase", "FirstPosition", "Fold", "FreeQ", \ "GreaterEqualThan", "GreaterThan", "GroupBy", "Insert", "KeyDrop", \ "KeyExistsQ", "KeyFreeQ", "KeyMap", "KeyMemberQ", "KeySelect", \ "KeySortBy", "KeyTake", "KeyValueMap", "LessEqualThan", "LessThan", \ "Lookup", "Map", "MapAt", "MapIndexed", "MatchQ", "MaximalBy", \ "MemberQ", "Merge", "MinimalBy", "NoneTrue", "Position", "Prepend", \ "Replace", "ReplaceAll", "ReplacePart", "Scan", "Select", \ "SelectFirst", "SortBy", "StringCases", "StringContainsQ", \ "StringDelete", "StringEndsQ", "StringFreeQ", "StringMatchQ", \ "StringPosition", "StringReplace", "StringReplacePart", \ "StringStartsQ", "SubstitutionSystem", "TakeLargest", \ "TakeLargestBy", "TakeSmallest", "TakeSmallestBy", "UnequalTo"}
Unfortunately, this list is missing at least AlphabeticOrder
, FoldList
and TuringMachine
.
There is a global variable that purports to contain a list of operator forms, TypeSystem`$OperatorForms
. I say "purports", because the list is missing some of the forms found by @ybeltukov's method. But to its credit, it correctly identifies the operator form of ReplaceAll
which is mentioned in neither a usage message nor the documentation, and also correctly omits StringCases
which has no operator form despite the usage message claiming otherwise:
Needs["TypeSystem`"]
$typeSystem = SymbolName /@ TypeSystem`$OperatorForms;
$usages =
Select[
Names@"*"
, StringMatchQ[ToString@ToExpression[#<>"::usage"],"*an operator form of*"]&
];
$usages ~Complement~ $typeSystem
(* {AssociationMap,CountDistinctBy,DeleteDuplicatesBy,MapAt,Merge,StringCases} *)
$typeSystem ~Complement~ $usages
(* {ReplaceAll} *)
There are three other operators which exhaustively partition TypeSystem`$OperatorForms
into the categories "left", "right" and "3-2":
TypeSystem`$LeftOperatorForms
(* {Map,KeyMap,Apply,Scan,MapIndexed} *)
TypeSystem`$RightOperatorForms
(* {Prepend,Append,GroupBy,CountsBy,Count,Position,FirstPosition,SortBy,KeySelect,
Select,SelectFirst,Delete,Extract,Replace,ReplacePart,ReplaceAll,Cases,
DeleteCases,FirstCase,AnyTrue,AllTrue,NoneTrue,KeyExistsQ,KeySortBy,
KeyTake,KeyDrop,MaximalBy,MinimalBy,MatchQ,FreeQ,MemberQ} *)
TypeSystem`$ThreeTwoOperatorForms
(* {Insert} *)
These categories appear to identify the position(s) of the curried arguments.
The results shown here are from version 10.0.1.
From version 10.3 you can use WolframLanguageData
.
WolframLanguageData[EntityClass["WolframLanguageSymbol", "Curryable"]]
As of 11.0, this appears to be the most reliable solution:
Unfortunately, this method is not perfect either: at least TuringMachine
is missing from it.
Hope this helps.