Shorthand notations are a part of the Wolfram Language's rich syntax system that allows multiple ways to feed arguments to functions. In addition to creating compact code, using shorthand notation lets you customize your workflow in the Wolfram Language.
For example, use Length with square brackets around a list to get the length of the list:
Pure functions are used very often in the Wolfram Language. They let you use a function without having to define an explicit name for it. You can use the shorthand notation for Function to give a pure function.
Use Function to give a pure function that raises the input to a cubic power:
The # and & symbols can be combined to accomplish the same thing. The # symbol serves as the placeholder for the variable, while the & symbol precedes the value you wish to substitute into the function:
Use Map to map a function over the elements of a list:
Apply has a shorthand notation as well (@@):
Perform the same operation using the shorthand notation for Function:
Extend this to include the shorthand notation for Map:
You will often need to use previous output in a new computation. This can be done by using the % symbol, the shorthand notation for Out.
Use the shorthand notation for Out, the % symbol, to specify the most recent output:
Use % with the shorthand notation for Part, [[...]], to take the first element of the list:
While convenient, referring to previous output by label or shorthand notation can quickly get out of hand since the current evaluation is always bound to the earlier output. Therefore, you must ensure that the output you want to use is available to your current computation. It is advised that you use this notation with caution.
Joining strings together is a frequently used string operation. Do this with StringJoin:
Using the shorthand notation for StringJoin, <>, this same operation can be written as:
StringExpression is a very important function that is used to represent strings. It is used by a number of string manipulation functions such as StringReplace, StringCases, StringSplit, and StringMatchQ.
Use StringExpression to create a string expression object:
Or directly use ~~, the shorthand notation for StringExpression: