61 questions linked to/from Replacement inside held expression
36 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 ...
171 views

### Evaluate an expression with variable values stored in the form “variable name” + val

Consider an expression exp = a^2 + b + c which has variables a, b, and ...
244 views

### different situations with Compilation of ConstantArray

First, we load some tools related to Compile for analysis. ...
56 views

### any way to stop all the following evaluations?

I often slect the whole notebook to evaluate. Sometimes some functions may return wrong parameters, which may happen, for example, I may have forgotten to specify values to some variables in the ...
125 views

### NMinimize works only if expression is pasted directly

Niminize works fine if I copy the minimized function directly by hands, but doesn't work if I try to do something like this: ...
1k views

### How to evaluate some parts of an expression inside Hold? [duplicate]

I want to return a Hold expression but with some parts pre-evaluated. The easiest way to explain this is probably through code example. Here is what I have ...
93 views

### How do I defer evaluate in conditional expressions when the arguments are list elements?

I'm trying to take a conditional expression like "3 > 1" as an argument for a function but without its evaluation before being passed. HoldForm works fine in situations like this: ...
83 views

### Emulating Case Pattern replacement

As most regular users, I have developed utility functions complementing the Wolfram language for frequent tasks. In particular, I have variations on Cases (see ...
894 views

### Collect and simplify both the coefficents and the matched patterns

(This is a far tighter version of a previous question I asked) The problem with Collect is that while Collect[exp, pattern, Simplify] will simplify the coefficients,...
131 views

### How to apply Set to held symbols listed in a variable?

I have a variable states that contains a list of held symbols: ...
233 views

### Extracting graphics primitives from a Graphics expression with ReplaceAll

If we have a graphics object, plt = Plot[Sin[x], {x, 0, Pi}] and we need to retrieve the discrete point data from it. This can be easily done by using ...
1k views

### Pass unevaluated function with evaluated arguments

I am almost sure that this question has been asked somewhere. I found similar ones, but I cannot find exactly what I need, which might mean that I am on the wrong track. I search a method to pass an ...
49 views

### How does the code idiom for replacing part of a held expression work? [duplicate]

I've seen this idiom used in different programs but never fully understand why it is necessary. Could someone explain? Is it still the recommended way to replace some part of a held expression to its ...