Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.6K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Get all the symbols with a pattern and save their Own, Down & Up values?

POSTED BY: Eric Smith
5 Replies
Anonymous User
Anonymous User
Posted 7 years ago

if your trying to preserve them (you said "save them" generically)...

you can save the (whole session), a function, or expressions and restore them as .mx i believe. it saves all pertinent info including up/down values.

(you don't need to extract info to "save them")

POSTED BY: Anonymous User

Try something like

In[1]:= var3 = 2;

In[2]:= ToExpression[#, InputForm, OwnValues] & /@ Names["var*"]

Out[2]= {{HoldPattern[var3] :> 2}}

In[3]:= Attributes[checkName] = HoldAll;
        checkName[x_] := StringMatchQ[SymbolName[Unevaluated[x]], "var*"]

In[5]:= checkName[var3]

Out[5]= True
POSTED BY: Ilian Gachevski

Thank you Illian, that gives me some hints. I've never used the third argument of ToExpression and haven't been able to use Unevaluated effectively. Great suggestions!

Appreciate the help!

POSTED BY: Eric Smith

This is a good tutorial on working with unevaluated expressions:

POSTED BY: Szabolcs Horvát

Awesome. I meant to ask for any kind of tutorial, class, or presentation on this topic. It's been a mystery to me for years. Thanks for the link.

POSTED BY: Eric Smith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard