I am just starting to learn functional programming, my choice is haskell. This was normal for several days until something happened in the console.
At first I thought the tutorial ( http://learnyouahaskell.com/starting-out ) is wrong
Prelude> [ (a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a^2 + b^2 == c^2] [(1,1,1)]
Must be (3,4,5) and (4,6,8) . I tried 3^2+5^2 , it spits out these arrays of numbers (something like 60 lines of numbers, about 3000 digits); 4^2+3^2 seems to produce the same numbers.
Trying to add any numbers, the result will be 100
Prelude> 100 + 200 100 Prelude> 300 + 500 100
I close the window and open it again, and the problem is solved.
Does this miscalculation often happen in Haskell? or maybe my version of Haskell is corrupt on boot? or Any chance it's a rare mistake?
source share