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)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 12

For questions relating to assignments to symbols, patterns, or expressions.

6
votes
But if we provide an alias for this symbol the UpValues never get called: Set is HoldFirst. That means that its first argument does not get evaluated before it is passed to Set. ms[1] = 2 never …
answered Sep 11 '17 by Szabolcs
17
votes
You can use Unset for this, like so: a[b_, c_] =. =. works with UpValues too (the full form of this has TagUnset): a /: Subscript[a,2] =. You need to use the same pattern in Unset that you used …
answered Jan 18 '12 by Szabolcs
12
votes
1answer
Some built-in variables trigger actions when their values are changed: In[17]:= $Assumptions=1 During evaluation of In[17]:= $Assumptions::bass: 1 is not a well-formed assumption. >> Out[17]= 1 …
asked Apr 24 '13 by Szabolcs
3
votes
A workaround is to use lexical (Module) scoping to localize B for Do in addition to the dynamic scoping that Do already has. Module[{B}, Do[f @@ B, {B, {{X, Y}}}]]; In short, Do does scoping by tem …
answered Apr 1 '16 by Szabolcs
11
votes
You can use the third argument of ToExpression to do this in a structured way: ToExpression["x", InputForm, Unset]
answered May 7 '13 by Szabolcs
4
votes
In this case you would need SetSharedFunction as you are dealing with DownValues. However, the communication overhead you introduce with this is likely going to negate any benefits or parallelization. …
answered Apr 19 '15 by Szabolcs
21
votes
Unique will do precisely this. Try for example Unique[x], which returns a symbol with a name similar to x$123. Here I should mention the Temporary attribute as well, which, when associated with a sy …
answered Jan 18 '12 by Szabolcs
13
votes
You could use myList = Hold[a,b,c,d] Function[x, x=5, {HoldAll}] /@ myList // ReleaseHold
answered Jan 19 '12 by Szabolcs
5
votes
Yes, it will be associated to Derivative. The basic way to check this is to look at the definition of Derivative: ?? Derivative This won't show anything about f, but it will show that Derivative ha …
answered Jun 7 '17 by Szabolcs
11
votes
He is simply saying that the first argument of Set is not evaluated before Set creates the definition. However, the sub-parts of the first argument are all evaluated, including the head(i.e. part 0). …
answered Mar 19 '18 by Szabolcs
11
votes
No, not a bug. Let's think about how AppendTo may be implemented (even though the actual implementation isn't inspectable). SetAttributes[appendTo, HoldFirst] appendTo[a_, val_] := (a = Append[a, va …
answered Nov 10 '16 by Szabolcs
14
votes
TracePrint will show you what happens: PreIncrement takes it's argument x, evaluates it (let's call the result result), then evaluates x = result+1. Note that PreIncrement has HoldFirst. Now ++(++x …
answered Feb 25 '12 by Szabolcs
6
votes
Another answer to What useful purpose does it serve that SetDelayed evaluates its first argument? is that it's convenient with patterns and optional arguments. Example with user-defined pa …
answered Sep 26 '15 by Szabolcs
21
votes
You asked for a general explanation instead of just focusing on specific application examples, so here it goes ... The concepts of "pass by reference" and "pass by value" that you may know from langu …
answered Sep 22 '17 by Szabolcs
2
votes
I would implement this as follows: tlist1 is essentially a lookup table, so let us use an association: tlist1 = <|"a" -> {1, 2, 3}, "b" -> {4, 5, 6}|>; (If you use Mathematica 9 or earlier, which …
answered Feb 23 '17 by Szabolcs

15 30 50 per page