4
$\begingroup$

This question already has an answer here:

What is the name for the function #1[#2]&?

I would call it Apply, so that Apply[Sin,2] is Sin[2], but the real Mathematica's Apply does a different thing.

$\endgroup$

marked as duplicate by Kuba, happy fish, Mr.Wizard Sep 25 '16 at 12:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Perhaps Operate? E.g., Operate[Sin,2,0]. $\endgroup$ – Alan Sep 25 '16 at 3:37
  • $\begingroup$ Nest[Sin,2,1] $\endgroup$ – george2079 Sep 25 '16 at 11:56
7
$\begingroup$

This would be Compose:

Compose[Sin, 2]
(* Sin[2] *)

#1[#2] &[Sin, 2]
(* Sin[2] *)
$\endgroup$
  • $\begingroup$ You must have been using Mma for a long time! One cannot even get documentation for Compose any more. $\endgroup$ – Alan Sep 25 '16 at 3:23
  • 1
    $\begingroup$ +1 as Compose is the closest thing we have. In the comments of (11298) there is some discussion about 1) a name for #1[#2]& or, more generally, for #1[##2]&; 2) whether Compose is a good name for that operation; and 3) the obsolescence of Compose. $\endgroup$ – WReach Sep 25 '16 at 4:53
3
$\begingroup$

Your function is anonymous. You can use it like this.

#1[#2]&[Sin, 30 °]

1/2

You can also give it a name.

apply = #1[#2]&;

then

apply[Sin, 30 °]

1/2

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.