Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*"
Favorites infavorites:mine
Status closed:yes
Types is:question
Exclude -[tag]
For more details on advanced search visit our help page
Results tagged with Search options user 142

Questions about how Mathematica evaluates expressions, tracing evaluation (Trace*), handling expressions in unevaluated form (Hold*, Unevaluated), nonstandard evaluation, etc.

You can watch the evaluations of a function using On: SetAttributes[zot, HoldFirst] zot[x_, y_] := {x, y} On[zot] In[11]:= zot[1+1, 2+2] During evaluation of In[11]:= zot::trace:zot[1+1,2+2 … ] --> zot[1+1,4]. During evaluation of In[11]:=zot::trace: zot[1+1,4] --> {1+1,4}. Out[11]= {2,4} Here we can see the original unevaluated arguments to zot and also the partially evaluated arguments …
answered Feb 28 '14 by WReach
is given the HoldAll attribute to delay the evaluation of the arguments until after we have had a chance to process them. It wraps the supplied sequence of symbols in Hold and then uses Replace to …
answered Apr 5 '14 by WReach
: Iteration limit of 4096 exceeded. >> *) To guard against this possibility, we make sure that the last definition only takes effect if the evaluation of its argument actually resulted in a change … themselves HoldAll because Block will temporarily disable that attribute as well, leading to evaluation leaks. It would also be unsuitable if the application will not tolerate the partial evaluation of expressions such as we see in the last example above. …
answered Jan 31 '15 by WReach
h[e1,e2,...]. The evaluation sequence is described in more detail in Chapter 7 of Power Programming with Mathematica by David B. Wagner. It is freely available to StackExchangers via (16485). When … they self-evaluate. Such symbols are said to be "inert". In the present case, f is inert. As a result, when evaluation gets down to the eleventh step the down-value of f is used to produce the …
answered Oct 11 '16 by WReach
We can define a new "variable container" that can be used to assign the same value to multiple variables: ClearAll[vars] SetAttributes[vars, HoldAll] vars /: s:(_vars = _) := CompoundExpression @@ Th …
answered Jan 21 '12 by WReach
Evaluation stops when there is no definition in place whose pattern matches the expression being evaluated. Conversely, evaluation will continue as long as there is a matching definition. Thus, if … I have this definition: zot[x_] := zot[x] and I evaluate zot[1], the evaluation will never terminate even though the expression never changes. (Well, in principle it will never terminate but …
answered Mar 17 '11 by WReach
prints the tracing information as execution proceeds instead of returning that information in the final evaluation result. Thus, TracePrint meets the stated requirement. However... The output of … the draw, it will crash. Also, the front-end is slow to respond to Abort Evaluation requests when large quantities of output are present. TraceScan TraceScan is an alternative to TracePrint that …
answered Jan 17 '15 by WReach
We can use some of Mathematica's built-in tracing facilities to help us answer this question. Let's start by ensuring that the symbols we are about to use carry no extraneous definitions: ClearAll[f …
answered Jan 28 '15 by WReach
. Responding to the Updated Question If we wish to update the original variables, we need to prevent the evaluation of the individual variables. For example: Scan[Function[Null, PrependTo[#, {"A", "B … programs the chance for so-called "evaluation leaks" to spring up grows quickly. All of the built-in destructive operators (like PrependTo, Set, SetDelayed etc) require held arguments. In other …
answered Mar 8 '17 by WReach
I agree with @Ymareth that the simplest thing would be to have the calling notebook take explicit measures to communicate the context to the target notebook. However, if for some reason it is undesir …
answered Dec 1 '14 by WReach
Short Version The behaviour we see is by design. It is due to the fact that we are using the special head Evaluate to force early evaluation of the second argument of CompoundExpression -- an … wrap the second expression within Evaluate, it is evaluated before the compound expression itself is evaluated: Print["one"]; Evaluate[Print["two"]] (* two one *) After that early evaluation and …
answered Jan 8 by WReach
discarding some of the trace information. TraceScan provides more information since it calls a user-specified function at the start and end of every evaluation. Two functions are defined below that try to … format the TraceScan information in (somewhat) readable form. traceView2 shows each expression as it is evaluated, along with the subevaluations ("steps") that lead to the result of that evaluation
answered Apr 3 '11 by WReach
[100]] $myAccumulator (* <|runningSum->5050|> *) Beware that this simple redefinition of partial still contains an evaluation leak. While the curried arguments are correctly preserved unevaluated …
answered Aug 18 '14 by WReach
We can explore the evaluation sequence using TraceScan. Let's start by defining a helper function, watch, that presents the results of TraceScan in a convenient form: ClearAll[watch] SetAttributes … , args]]] ; exit[args__] := With[{d = --depth}, fn[Hold["exit", d, args]]] ; TraceScan[enter, expr, _, exit] ] Now, let's look at the evaluation of q from the supplied use cases: In[10] := watch[q …
answered Jan 21 '12 by WReach
the original definition to unwrap the association object during the initial evaluation and to recreate it upon use. We do that using Normal@URLParse[...] and Inactive[URLBuild@*Association]. The …
answered Aug 2 by WReach

15 30 50 per page