Timeline for Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Current License: CC BY-SA 3.0
3 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 6, 2013 at 19:45 | comment | added | ecoxlinux | Right. Although in some cases that may be also what you want to achieve when evaluating f[x] (i.e., treating x as the function variable). | |
| Mar 6, 2013 at 19:33 | comment | added | Szabolcs | Perhaps it's good to mention that the usual caveat applies: if this is used in a function in a way similar to f[z_] := Block[{x, expr}, expr = 2 x + z; Function[x, Evaluate[expr]]], then f[x] will give an incorrect result. It's necessary to make sure that the function doesn't take symbolic arguments that are used together with the Block-variables. @acl's solution doesn't suffer from this problem. | |
| Mar 6, 2013 at 19:31 | history | answered | ecoxlinux | CC BY-SA 3.0 |