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$ Commented Aug 15, 2017 at 23:39
  • $\begingroup$ @CarlWoll Oops, thanks! ;-) $\endgroup$ Commented 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$ Commented Aug 16, 2017 at 1:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.