# Defining Function with right T arrow

I found a tutorial that preferred the use of the right T arrow (Esc fn Esc) to define functions which I had never seen before.

It took me a while to find it in the Function help page buried in the Details section but it is interesting to note that it isn't referenced in the basic examples and seems to be very uncommon in general usage (at least in the books I've purchased and the pdf tutorials I've found online).

Perhaps it is very new or very old and people just get used to the # & and f[ _ ]:= formats?

Can anyone comment on why this isn't more commonly used or is it just a matter of style?

• For those who want to read that tutorial: the usage starts from page 22. – vapor Apr 16 '17 at 7:51

## 2 Answers

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}

Function[a, {a, 1}]


Parentheses force the precedence:

(a \[Function] {a, 1})

{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 // a \[Function] {a, 1} // a \[Function] {a, 2} // a \[Function] {a, 3}


Function::flpar: Parameter specification a in Function[a,Function[a[{a,1}],Function[a[{a,2}],{a,3}]]] should be a symbol or a list of symbols. >>

Function[a, 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]

Map[x \[Function] x^2, Range]