As far as I know, no. You could determine it at runtime via Stack maybe.
– b3m2a1Apr 02 '19 at 20:25
A fuller example would be helpful, as there is more than one kind of function in Mathematica. For instance, if you are writing the function yourself, you could simply type it yourself: f[x_] := (Print["My name is ", f]; x^2)
– Michael E2Apr 02 '19 at 20:31
2
One could write the function call : f[x_] := (Print["Hi! You called ", HoldForm[call]]; x^2) and then f[4].
– Michael E2Apr 02 '19 at 20:33
Sorry for the lack of clarity. I am trying to avoid having to type the function name twice, for no real reason other than neatness. A print statement really doesn't do the trick, but to help clear up the question lets say I wanted to print a label for a plot with the function name as the label; is there any way to determine the function name without hard coding it?
– BOUNCEApr 02 '19 at 20:35
2
@tombom21 while answers in the linked topic suggest 'not without trickery' I believe it is a duplicate. Let me know if you disagree.
– KubaApr 02 '19 at 20:36
Stackmaybe. – b3m2a1 Apr 02 '19 at 20:25f[x_] := (Print["My name is ", f]; x^2)– Michael E2 Apr 02 '19 at 20:31call : f[x_] := (Print["Hi! You called ", HoldForm[call]]; x^2)and thenf[4]. – Michael E2 Apr 02 '19 at 20:33