Google
 
Web unafbapune.blogspot.com

Thursday, October 06, 2011

 

List Comprehension in Haskell

To use Haskell to find a right angle triangle that has:In ghci, type:
[(a,b,c) | c <- [1..10], b <- [1..c], a <- [1..b], a+b+c == 24, a^2+b^2 == c^2]
Output:
[(6,8,10)]
Pretty amazing :)

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?