MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to produce variable substitution list?

  • To: mathgroup at
  • Subject: [mg90919] Re: How to produce variable substitution list?
  • From: Valeri Astanoff <astanoff at>
  • Date: Tue, 29 Jul 2008 06:10:27 -0400 (EDT)
  • References: <g6mat3$i19$>

On 29 juil, 07:47, Stoney Ballard <ston... at> wrote:
> Is there a straight-forward way to write a function that takes a list
> of symbols that are bound in the calling environment and produce a
> list such as is produced by Solve, like {var1->val1, var2->val2,...}?
> Currently, I'm using an expression (not a function) like {Hold[var1]->var=
1, Hold[var2]->var2}, which produces the right result, but it
> looks bad to duplicate the symbols. I want something that looks clean,
> like bindings[var1, var2,...].
> I know this isn't lisp, and there's no binding environment as such,
> but it would expect this to be doable.
> TIA for any suggestions.
> =A0- Stoney

Good day,

This is a solution inspired from Roman Maeder's
"Programming in Mathematica":

In[1]:=3D SetAttributes[myRules,HoldAll];
List@@(# -> ReleaseHold[#]& /@ vv)

In[2]:=3D var1=3D3; var2=3D5;

Out[4]=3D {Hold[var1]->3,Hold[var2]->5}


  • Prev by Date: Re: question about sorting lists
  • Next by Date: Re: Adding assumptions to SOLVE
  • Previous by thread: How to produce variable substitution list?
  • Next by thread: Re: How to produce variable substitution list?