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.
-----------------------------------------------------------------------------