mathematica expressions in Compile

*To*: mathgroup at smc.vnet.net*Subject*: [mg61995] mathematica expressions in Compile*From*: "boyandshark" <amitgandhi at gmail.com>*Date*: Tue, 8 Nov 2005 03:41:35 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hello - I was wondering what is happening in the following example : Compile[{}, Module[{i = 0, nums}, nums = {0, 0, 0}; i = First[Ordering[{1., 2., 3.}]]; nums[[i]]++; nums]]; I get an error when trying to evaluate this statement because Mathematica complains about assigning i the value of the First[Ordering[_]] expression - Compile seems to think First[Ordering[_]] in this example is a real number whereas I initialized i to be an integer. I can solve this simply by Compile[{}, Module[{i = 0, nums}, nums = {0, 0, 0}; i = Round[First[Ordering[{1., 2., 3.}]]]; nums[[i]]++; nums]]; My question is - how come Compile knows that the value of Round is an integer, but does not know that the First[Ordering[_]] is an integer? Thank you.