Thursday, October 06, 2011
List Comprehension in Haskell
To use Haskell to find a right angle triangle that has:
- all three sides as integers
- each side less than or equal to 10
- a perimeter of 24
Output:[(a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a+b+c == 24, a^2+b^2 == c^2]
Pretty amazing :)[(6,8,10)]