This is because you've got the order of things to
right :: Int -> [(Int,Int,Int)]
right n = [(a,b,c) | [1..n] <- a, [a..n] <- b, [b..n] <- c, a*a + b*b == c*c]
backwards.
我有以下Haskell脚本。
当我在ghci中编译脚本并输入 "right 10 "时,我得到一个错误信息 "* 变量不在范围内:right :: Integer -> t"
Parse error in pattern: [1 .. n]
Possibly caused by a missing 'do'?
<-
我有下面的Haskell脚本,右键 :: Int -> [(Int,Int,Int)] 右键 n = [(a,b,c)