Re: how to get an assignment from a rule ?
- To: mathgroup at smc.vnet.net
- Subject: [mg29329] Re: how to get an assignment from a rule ?
- From: "Kevin J. McCann" <KevinMcCann at home.com>
- Date: Thu, 14 Jun 2001 02:27:11 -0400 (EDT)
- References: <9g7411$cf3$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Guido, I assume that what you would like is to have a=b and c=d. Here is a
way
a=.;
c=.;
(* You have the following rule from something else *)
rul={a->b,c->d}
rul/.Rule->Set
(*Now check to see that the assignment has been made *)
{a,c}
(*Mathematica should output {b,d} *)
To see why this works type
rul//Fullform
you will see something like this
List[Rule[a,b],Rule[c,d]]
when you typed rul/.Rule->Set, you changed the "Rule" in the above to "Set"
that is you made the assignments.
Cheers,
Kevin
The wise words of Guido Carlet on Wednesday 13 June 2001 03:16:
> Anybody knows how to do this in Mathematica ?
>
> I have a list of rules:
>
> {a->b, c->d}
>
> and I want to get the corresponding assignments:
>
> a = b
>
> c = d
>
> Is there a command in Mathematica to do this ?
>
> Thank you !
>
>
>
>
>