How to get disjunction elements into a list?

Some Mathematica results are returned as disjunctions in the form a || b || c , and the internal form is Or[a,b,c].

How do I convert this expression to a list { a, b, c }, for any number of elements in the original disjunction?

I’m a Mathematica beginner, and I can see several ways to do it ‘manually’, but I’ve learned enough about Mathematica to know that there is always a simple, clean way to do simple things like this.

Thanks in advance for any help.

Simply change the Head of the expression (Or) to List, which can be done in many ways:

f=Or[a,b,c]
List@@f
Apply[List,f]
f/.Or->List
f[[0]]=List;
f

Hope that works for you!

Great - just what I was looking for. Thanks a lot!

Hope this helps:

In[1]:= Reduce[x^2 == 1, x]
Out[1]= x == -1 || x == 1

In[2]:= {ToRules[%]}
Out[2]= {{x -> -1}, {x -> 1}}

In[3]:= x /. %
Out[3]= {-1, 1}

In[4]:= Solve[x^2 == 1, x]
Out[4]= {{x -> -1}, {x -> 1}}

In[5]:= x /. %
Out[5]= {-1, 1}