Like APL, J or Haskell, Wolfram comes up with a lot of shorthand notation, in addition to the prefix, postfix or infix notation. For instance, you can write Normal[•]
or • // Normal
, where •
is any valid Wolfram expression. Here is a brief list of what I’ve collected over the years, from various sources. Usually, I tend to stick to plain text expression (so called circumfix notation), i.e. Length[{1,2,3}]
rather than Length@{1,2,3}
or {1,2,3}//Length
. I tend to use the //
postfix notation for things like Normal
or MatrixForm
. The only exception is for pure function and Apply
(@@
) or Map
(/@
). Sometimes I combine them all, like in the example provided on Wolfram Howto’s:
(#^3 + a) & /@ {1, 2, 4, 6, 5, 8}
Anyway, here’s the list of expression that I am aware of:
Expression | Alternative | Role |
@ | f[•] | function application |
/@ | Map[f, •] | map function to list |
//@ | MapAll[f, •] | map function to every subexpression |
@@ | Apply[f, •] | Apply list to function |
@@@ | Apply[f, •, {1}] | Apply list to function at first level |
@* | Composition[f, g] | composition of functions, e.g. f[g[x]] |
/* | RightComposition[f, g] | right composition of functions, e.g. g[f[x]] |
<> | StringJoin[•, •] | concatenate string |
/. | Replace[•, •] | replace expression by pattern |
//= | ApplyTo[•, f] | assignment with function application |
+= | AddTo[•, •] | like in C or Python |
++ | Increment[•] | like in C |
/. | ReplaceAll[•, •] | applies a rule to transform each subpart of an expression |
;; | Span[•, •] | span of elements from start to stop |
{} | List[•] | create a list |
#^2&[3] | Function[x, x^2][3] | example of a pure function |
I don’t know of any shortcut for Thread
or MapThread
♪ Evanescence • Bring Me to Life