- A+

Category：Languages

Here is very simple Haskell code to find all the Pythagoras integers from 1 to 200 that satisfied the Pythagoras Theorem X^2 = Y^2 + Z^2

Haskell:

`let l = [1..200] let pythagoras = [ x | x <- l, y <- l, z <- l, x^2 == y^2 + z^2] `

It takes **24.1 seconds** to finish it,

Swift: Using standard for loop **0.05 seconds**

C: Using standard for loop **0.022 seconds**

Wish I could comment this...

Why is Haskell so slow compared to C for Fibonacci sequence?

Always make sure you're compiling your code, since interpreting it is very time-consuming.