MathGroup Archive 1995

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

Search the Archive

Re: Convert Products to Lists


In article <3p8ssc$6cr at news0.cybernetics.net>, bob at zim.uoregon.edu (Robert Zimmerman) writes:
>Is it possible to convert a product of numbers to a list of numbers.  
[snip]
>but it doesn't work for numbers
>
>2  4  6//.Times->List
>48
>
>Can it be done?

You need to wrap Hold around the numbers to prevent the evaluation of Times,
and then ReleaseHold after replacing the head. ie.

In[1]:= ReleaseHold[Hold[2 4 6] //. Times->List]
Out[1]= {2, 4, 6}

Paul E Howland                         

Long Range Ground Radar Systems Section               tel. +44 (0)1684 895767
CSS2 Division, Room BY209                             fax. +44 (0)1684 896315
Defence Research Agency                           email: PEHOWLAND at DRA.HMG.GB 
Malvern, Worcs, WR14 3PS, UK.                      
-----------------------------------------------------------------------------



  • Prev by Date: NeXT Mma 2.0 as Front-End to Mma 2.2?
  • Next by Date: changing the order of expand
  • Previous by thread: Re: Convert Products to Lists
  • Next by thread: Q: How to load packages inside a package