Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Convert Products to Lists

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1169] Re: Convert Products to Lists
  • From: pehowland at taz.dra.hmg.gb (Paul E. Howland)
  • Date: Sat, 20 May 1995 03:23:27 -0400
  • Organization: Defence Research Agency

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