Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example assume that the following code is given

f[x_, y_]:=
   Block[{a, b},
      a = Sin[x];
      b = Cos[y];
      c = a + b

and I want to change it into (without doing too much typing myself)

prepareAB[x_, y_] := {Sin[x], Cos[y]};

f[x_, y_]:=
   Block[{a, b},
      {a, b} = prepareAB[x, y];
      c = a + b

Is this functionality available in workbench?

share|improve this question
This seems to be a non-trivial enough transformation that I would not expect any support for this kind of refactorings. Besides, I personally don't find that the majority of my development time is spent on re-typing during such refactorings, so, for me at least, such a feature (even if existed) would not be a major productivity booster. – Leonid Shifrin Mar 26 '14 at 12:07
on my part, I needed that functinality rather often. I certanly would like to see it implemented. though I agree that it is a highly non-trivial in the context of mathematica. there is so much to keep track off... – zorank Mar 31 '14 at 18:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.