Sum of a series: Difference between revisions

→‎{{header|Haskell}}: use ^ operator, added a couple more ways to do it
m (→‎{{header|Python}}: whoops, extra space)
(→‎{{header|Haskell}}: use ^ operator, added a couple more ways to do it)
Line 87:
 
=={{header|Haskell}}==
With a list comprehension:
sum $ map (\x -> 1/(x*x)) [1..1000]
sum [1 / x ^ 2 | x <- [1..1000]]
With higher-order functions:
sum $ map (\x -> 1 /( x*x) ^ 2) [1..1000]
In [http://haskell.org/haskellwiki/Pointfree point-free] style:
(sum . map (1/) . map (^2)) [1..1000]
 
=={{header|J}}==