[1..n]

问题描述 投票:-1回答:1
I think you haven't actually compiled your script in ghci yet. When I try, I get an error message:

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"
haskell ghci
1个回答
5
投票

Parse error in pattern: [1 .. n]
Possibly caused by a missing 'do'?

<-我有下面的Haskell脚本,右键 :: Int -> [(Int,Int,Int)] 右键 n = [(a,b,c)

© www.soinside.com 2019 - 2024. All rights reserved.