Hi
I have been learning clojure for some time but am a bit stumped when
translating code with nested for loops.
Can someone help me to translate the following java code to clojure
elegantly:
The inputs are two arrays of type double of the same length -
dailyValues and totalValues. The output is the array contrib of the same
length.
int n = dailyValues.length;
for (int i = 0; i < n; i++)
{
sum = 1.0;
for (int j = i + 1; j < n; j++)
{
sum *= (1.0 + (totalValues[j] / 100.0));
}
contrib[i] = sum * dailyValues[i];
}
Many thanks for your help.
-- Shoeb
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en