Skip to main content

All Questions

3 votes
1 answer
98 views

Prevent argument substitution in held expression when injecting into unevaluated code

I want to write a custom sow/reap pair to wrap any piece of code in sow[code] and call reap ...
István Zachar's user avatar
3 votes
2 answers
387 views

Expanding powers in an expression and Hold

Let an expression like -(1/2) + (3 x^5)/2 be given. How can this be turned into -(1/2) + (3 x x x x x)/2? All powers of ...
JHT's user avatar
  • 1,005
3 votes
4 answers
220 views

Operations on expressions within Hold

I want to convert {Hold[1 + 2], Hold[3 + 4], Hold[5*6]} into Hold[{1 + 2, 3 + 4, 5*6}]. I have tried ...
expression's user avatar
  • 5,662
106 votes
5 answers
6k views

Replacement inside held expression

I wish to make a replacement inside a held expression: f[x_Real] := x^2; Hold[{2., 3.}] /. n_Real :> f[n] The desired output is ...
Alexey Popkov's user avatar