This is a rather general question, which I fail to answer myself. I guess it is mainly due to my insufficient knowledge of the precise terms.
If I understand correctly, the following are equivalent:
f = Function[u, 3 + u]
f = Function[3 + #]
f = (3+#) &
f[x_]:=3+x
In all cases f[a]
would yield 3+a
. Similarly, f[a]
is equivalent to f@@{a}
.
I have mainly two questions:
- What is the right term to call the shorter version, i.e. the version where one uses
@@
,#
,&
etc.? - When should I prefer the one method and not the other? It seems like many answers given around MA.SE uses the "shorter version". What are the advantages and disadvantages...
Bonus question: Note my first question. I hope I could get more fishing rods and less fish. In other words, what is the official term for these two notions? Where are can I find documentation of these differences? The examples I presented in the this questions are merely examples, and I try to understand where can I rigorously study these notions and similar ones.
Comments
Post a Comment