MathGroup Archive 2010

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

Search the Archive

Re: ReplaceAll reloaded

  • To: mathgroup at
  • Subject: [mg107430] Re: ReplaceAll reloaded
  • From: Bill Rowe <readnews at>
  • Date: Fri, 12 Feb 2010 04:43:37 -0500 (EST)

On 2/11/10 at 5:15 AM, zac at (Istv=C3=A1n Zachar) wrote:

>Can you please explain why ReplaceAll does not return a simple list?

>x = Or[a, b];
>x /. Or[y__] :> {y}

>Out[24]= {a || b}

Others have explained why you don't get the list you wanted and
how you can achieve what you want with replacement rules. I
thought I would point what I see as a more direct, simpler way
to change this expression or similar expressions to a list. That
would be by using Apply. For example,

In[2]:= x = Or[a, b]

Out[2]= a || b

In[3]:= List @@ x

Out[3]= {a,b}

  • Prev by Date: Re: download data from database
  • Next by Date: Re: Plotting two list variables
  • Previous by thread: Re: Re: ReplaceAll reloaded
  • Next by thread: Mathematica plaintext output