Re: Rule
- To: mathgroup at smc.vnet.net
- Subject: [mg24904] Re: Rule
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 20 Aug 2000 01:34:53 -0400 (EDT)
- References: <8nlifh$9hs@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
We will need to prevent {a=b;b=c;e=f} evaluating.
Hold[{a = b; b = c; e = f}] /. {CompoundExpression[x__]} -> List[x]
Hold[{a = b; b = c; e = f}]
ToExpression[StringReplace[ToString[Hold[{a = b; b = c; e = f}]],
";" -> ","]]
Hold[{a = b, b = c, e = f}]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Wissam Alsaidi" <alsaidi at pacific.mps.ohio-state.edu> wrote in message
news:8nlifh$9hs at smc.vnet.net...
> Hi all;
> Is there a rule for transforming ; to ,(comma).
> IN THIS case one can transform a set of expressions to a list.
>
> example
> {a=b;b=c;e=f}/.{;->,}
> and the ansere will be
> {a=b,b=c,e=f}.
>
>
>
>