0
$\begingroup$
Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 1]

Level 1 of Replace works here as expected with output {List,List}

Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 2]

But with level 2 I would expect something like {{Power,Power},{Plus,Plus}}. However, the output still is {List,List}. Why?

$\endgroup$
3
  • $\begingroup$ Use {2} instead of 2. $\endgroup$
    – Carl Woll
    Aug 15, 2017 at 23:39
  • $\begingroup$ @CarlWoll Oops, thanks! ;-) $\endgroup$ Aug 15, 2017 at 23:42
  • $\begingroup$ @Gambit I have marked this question as already has an answer with links pointing to two older questions. I believe you will find these informative. If you still have questions let me know. $\endgroup$
    – Mr.Wizard
    Aug 16, 2017 at 1:07

0

Browse other questions tagged or ask your own question.