MathGroup Archive 2006

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

Search the Archive

Re: Unevaluated a[[1]]*a[[2]]


unevalTimes[x_List]:=
    Module[{s=ToString/@x},
      Fold[#1<>" * "<>#2&,First[s],Rest[s]]];

a={0.1245,0.543};

x=unevalTimes[a]

0.1245 * 0.543

ToExpression[x]==Times@@a

True

x=unevalTimes[Range[7]]

1 * 2 * 3 * 4 * 5 * 6 * 7

ToExpression[x]==7!

True


Bob Hanlon

> 
> From: "Alexandre Costa" <amscosta at uem.br>
To: mathgroup at smc.vnet.net
> Subject: [mg65180] [mg65165] Unevaluated a[[1]]*a[[2]]
> 
> Dear Group,
> Suppose I have  a = {0.1245, 0.543};
> I want to check the values of the product:
> a[[1]]*a[[2]]. So I just want to see the product unevaluated as output: 
> 0.1245*0.543.
> Thanks,
> Alex
> 
> 
> 


  • Prev by Date: Different font behavior between kernel and front-end
  • Next by Date: Re: getting one random number
  • Previous by thread: Re: Unevaluated a[[1]]*a[[2]]
  • Next by thread: How to get rid of If[ ... ] in a result