Timeline for Elegant manipulation of the variables list
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 10, 2012 at 4:37 | vote | accept | Alexey Popkov | ||
Jan 10, 2013 at 20:33 | |||||
Sep 7, 2012 at 14:57 | history | edited | Simon Woods | CC BY-SA 3.0 |
deleted 4 characters in body
|
Sep 7, 2012 at 14:56 | comment | added | Simon Woods |
@SjoerdC.deVries, good point. I've changed the code to use ValueQ instead.
|
|
Sep 7, 2012 at 14:20 | comment | added | Sjoerd C. de Vries | Would OP's "value" mean "numerical value"? If not, the pattern test NumericQ might be incorrect. | |
Sep 7, 2012 at 9:59 | comment | added | Simon Woods | @AlexeyPopkov, updated with your suggestions. | |
Sep 7, 2012 at 9:56 | history | edited | Simon Woods | CC BY-SA 3.0 |
added 72 characters in body
|
Sep 7, 2012 at 9:30 | comment | added | Alexey Popkov |
For clearing one variable: Extract[vars, 1, Hold] /. Hold[x_?NumericQ] :> Unset[x]
|
|
Sep 7, 2012 at 9:24 | comment | added | Alexey Popkov |
The only workaround I see at the moment is: List @@ Replace[vars, x_?NumericQ :> Unset[x], {1}] . But it is not very elegant when only one variable should be cleared.
|
|
Sep 7, 2012 at 9:15 | comment | added | Alexey Popkov |
Hold[x_[__]] | Hold[x_] :> Clear[x] in the new version clears all indexed variables with the same Head , not the one.
|
|
Sep 7, 2012 at 8:44 | history | edited | Simon Woods | CC BY-SA 3.0 |
deleted 27 characters in body
|
Sep 7, 2012 at 8:43 | comment | added | Simon Woods | @AlexeyPopkov, oops I missed that! I'll have another look... | |
Sep 7, 2012 at 8:32 | comment | added | Alexey Popkov |
Some of the variables are indexed variables (U0[1] etc.) so Clear and SymbolName will not work.
|
|
Sep 7, 2012 at 8:27 | history | answered | Simon Woods | CC BY-SA 3.0 |