Tag Info

New answers tagged

4

In Mathematica version 10, you can also use Inactive to allow the Symbol to be created before doing the assignment. Here is an example: Clear["x"]; Activate[Inactive[Set][Symbol["x"], 3]] (* ==> 3 *) x (* ==> 3 *)


0

I'd use fs = Reap[Do[With[{n = n}, Sow[#^n &]], {n, 0, 10}]][[2, 1]] {#1^0 &, #1^1 &, #1^2 &, #1^3 &, #1^4 &, #1^5 &, #1^6 &, #1^7 &, #1^8 &, #1^9 &, #1^10 &} Your methods 2 & 3 don't work because Function has the attribute HoldAll and therefore m = 2; #^m & #1^m & With can be used "to ...


7

tree = Function[x, Defer @ FullForm @ x, HoldAll]; Now: 2 + 2 // tree Plus[2, 2] I used Defer to allow the output to be evaluated. If you do not prefer this replace it with HoldForm. For some explanation of the mechanics of this code see: Why doesn't "Defer" work with "TableForm"? See also my standard methods for ...



Top 50 recent answers are included