Defining Function with right T arrow
I do make use of \[Function]
myself, but rarely.
As Shadowray notes it does not present well outside of the Notebook so it is not as "nice" for preparing answers here on Stack Exchange.
The primary reason I don't use it more often, and simultaneously the primary reason I use it when I do, is that its precedence feels a little odd. Regular &
functions are direct to apply and it is easy to string a few together:
{#, 3} & @ {#, 2} & @ {#, 1} & @ 0
{{{0, 1}, 2}, 3}
0 // {#, 3} & // {#, 2} & // {#, 1} &
{{{0, 3}, 2}, 1}
With \[Function]
even a simple application require more work; this does not do what I "expect:"
a \[Function] {a, 1}[5]
Function[a, {a, 1}[5]]
Parentheses force the precedence:
(a \[Function] {a, 1})[5]
{5, 1}
Stringing operations doesn't quite work either:
a \[Function] {a, 1} @ a \[Function] {a, 2} @ a \[Function] {a, 3} @ 0
Function[a, Function[{a, 1}[a], Function[{a, 2}[a], {a, 3}[0]]]]
0 // a \[Function] {a, 1} // a \[Function] {a, 2} // a \[Function] {a, 3}
Function::flpar: Parameter specification a[0] in Function[a[0],Function[a[{a,1}],Function[a[{a,2}],{a,3}]]] should be a symbol or a list of symbols. >>
Function[a[0], Function[a[{a, 1}], Function[a[{a, 2}], {a, 3}]]]
Of course parentheses can force grouping here too, but it doesn't make this syntax convenient in most cases.
The precedence is convenient in other cases where one actually wants it. I'll try to add an example or two later if I have time.
I think this is more like a personal preference. But I see a couple of possible issues with \[Function]
:
First, \[Function]
looks very similar to \[Rule]
and can make reading of the source code more difficult.
Second, it can look cumbersome, especially in an external editor. Compare for example the following two expressions:
Map[(#^2)&, Range[10]]
Map[x \[Function] x^2, Range[10]]