MathGroup Archive 1995

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

Search the Archive

Re: Convert Products to Lists

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1151] Re: Convert Products to Lists
  • From: ianc (Ian Collier)
  • Date: Wed, 17 May 1995 05:59:27 -0400
  • Organization: Wolfram Research, Inc

In article <newsclip4413p8ssc$6cr at news0.cybernetics.net>,
bob at zim.uoregon.edu (Robert Zimmerman) wrote:

> Is it possible to convert a product of numbers to a list of numbers.  
> It can be done for symbols, 
> 
> 
> a b c //.Times->List
> {a, b, c}
> 
> but it doesn't work for numbers
> 
> 2  4  6//.Times->List
> 48
> 

Try using HoldForm:

In[72]:=
    ?HoldForm

HoldForm[expr] prints as the expression expr, with expr
   maintained in an unevaluated form.

In[73]:=
    HoldForm[2  4  6]/.Times->List
Out[73]=
    {2, 4, 6}
I hope this helps,

--Ian

----------------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
----------------------------------------------------------------
Tel (217) 398-0700        Fax (217) 398-0747        ianc at wri.com
Wolfram Research Home Page                   http://www.wri.com/
----------------------------------------------------------------


  • Prev by Date: Re: How fast are Mathematica Versions ?
  • Next by Date: Q: How to load packages inside a package
  • Previous by thread: Sort[] accuracy problem
  • Next by thread: Re: Convert Products to Lists