Linked Questions
14 questions linked to/from How to inject an evaluated expression into a held expression?
6
votes
1answer
697 views
How to convert an image to a compressed string representation equivalent to one copied to clipboard by `CopyToClipboard[image]`?
In my recent question I asked How to embed an image into a string?
The suggested solution was
...
92
votes
4answers
5k 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 ...
17
votes
3answers
2k views
How to implement a regular grammar?
What is the most simple, elegant way of implementing a rewrite-system defined as:
$$
\begin{aligned}
\Sigma &= \{a_1, a_2, a_3, ...\} \\
N &= \{A_1, A_2, A_3, ...\} \\
\{\alpha_1 , \...
22
votes
2answers
4k views
Determine whether some expression contains a given symbol
Given a symbol t and an expression expr, how can I determine whether or not the symbol t ...
558
votes
19answers
141k views
Where can I find examples of good Mathematica programming practice?
I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
132
votes
8answers
8k views
Can one identify the design patterns of Mathematica?
... or are they unnecessary in such a high-level language?
I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
67
votes
10answers
3k views
Injecting a sequence of expressions into a held expression
Consider the following toy example:
Hold[{1, 2, x}] /. x -> Sequence[3, 4]
It will give
Hold[{1, 2, Sequence[3, 4]}]
...
40
votes
4answers
3k views
Compiling more functions that don't call MainEvaluate
I would like to use Compile with functions defined outside Compile.
For example if I have the two basic functions ...
13
votes
2answers
1k views
Displaying a series obtained by evaluating a Taylor series
Description of problem
I would like to use Mathematica to display the series obtained by substituting a value for $x$ in a Taylor series expansion. The terms of the series will be rational numbers, ...
0
votes
0answers
210 views
How to evaluate only arguments, but leave topmost expression unevaluated? [duplicate]
I want to represent expressions mostly in unevaluated form, but being able to evaluate it's subparts.
For example, how to evaluate only arguments, but leave topmost expression unevaluated?
For ...
1
vote
1answer
161 views
Using With in combination with Graphics [duplicate]
Assume that we are given a symbol p={x,y} which should represent a 2D point. If x and y have ...
18
votes
4answers
2k views
Pure Functions with Lists as arguments
Assuming I have two function:
example 1:
add[{x_, y_, z_}] := x + y - z
add[{1, 3, 5}]
If use pure function,I know I can write it as :
...
18
votes
1answer
570 views
Removing calls to MainEvalute when using inlined compiled closures
This question is tightly related to the answer Shaving the last 50 ms off NMinimize.
There @OleksandR shows how inlined closures can be used to eliminate calls to ...
17
votes
3answers
419 views
Is there a way to require confirmation for execution of certain cells?
Often I have Notebooks where I generate several images and export them into files. Now when I want to change one image, I'd like to just re-evaluate the complete notebook, however I generally do not ...