New answers tagged


You could do this: Function[{a, b, c, d, e}, Graphics[{{PointSize@Medium, Point[{a, b, c, d, e}]}, Line[{{a,b}, {a,c}, {a,d}, {a,e}, {b,c}, {b,d}, {c, e}}]}]]@@CirclePoints[5] I used a Function to localize the variables and then applied it to the desired points with @@.


The answer is no. The 1st argument of With does not allow destructuring. It only accepts a list of simple assignments. I would rewrite the example you give as Module[{a, b, c, d, e}, {a, b, c, d, e} = CirclePoints[5]; Graphics[ {{PointSize @ Medium, Point[{a, b, c, d, e}]}, Line[{{a, b}, {a, c}, {a, d}, {a, e}, {b, c}, {b, d}, {c, e}}]}]]


ClearAll[a, b]; a := 1 + 1 b = Sqrt Is this acceptable? foo = # /. Join @@ Cases[#, s_Symbol :> OwnValues[s], ∞, Heads->True] &; foo @ Hold[a + b[c]] Hold[(1 + 1) + Sqrt[c]] Update As OP has noticed I've missed the fact that ReadProtected symbols won't show its OwnValues. We could do something like s_Symbol /; FreeQ[ Attributes[s], ...


The $ is a symbol used by Mathematica to generate local variable names for variables that are confined to a particular scope. For instance, if you run Module[{x}, Print[x]] you'll find it prints something like x$4456. This is the name Mathematica gave the variable to distinguish it from any other x's outside the Module.


Why is this happening The explanation was basically given by ciao in comments. You can also find a lot of information on this in this great answer of Mr.Wizard. I will perhaps try to view it from a somewhat different perspective. To understand what happens, one should go back and consider what happens when we enter and execute some code. The steps are ...

Top 50 recent answers are included