实验要求
module MyTriads where
triads :: Int -> [(Int, Int, Int)]
-- triads 的定义
triads2 :: Int -> [(Int, Int, Int)]
---- triads2 的定义
triads n = [(x,y,z)|x<-[1..n],y<-[1..n],z<-[1..n],x*x + y*y == z*z]
triads2 n = [(x,y,z)|x<-[1..n],y<-[1..n],z<-[1..n],x*x + y*y == z*z && x < y]
未经允许不得转载:MikuAlpha's Blog » 毕达哥拉斯三元组–Haskell实验2-1