You beat me to the J solution, but here it is in APL:
+/2*⍨⍳10
No need for increment, since index is set to start at 1. You can set it to 0 too, if you work that way.
+ addition
/ reduce
2 (to be fed to exponential operator * for square)
* exponential
⍨ commute
⍳ iota - index generator
I would consider C++ with this library over Haskell just because you get the world of C++, but with a bit more of the expressiveness I like in the functional languages.
+ addition
/ reduce
2 (to be fed to exponential operator * for square)
* exponential
⍨ commute
⍳ iota - index generator
I would consider C++ with this library over Haskell just because you get the world of C++, but with a bit more of the expressiveness I like in the functional languages.