0
我该怎么定义,运行前奏此功能beginsWithU功能,制作和运行,在前奏
let beginsWithU (c:_) = c == 'u' || c == 'U'
beginsWithU _ = False
2号线,给人parse error on input ‘=’
。我不能使用让再次,因为它会覆盖模式1行
我该怎么定义,运行前奏此功能beginsWithU功能,制作和运行,在前奏
let beginsWithU (c:_) = c == 'u' || c == 'U'
beginsWithU _ = False
2号线,给人parse error on input ‘=’
。我不能使用让再次,因为它会覆盖模式1行
我想你想运行它里面ghci中。 您可以对此使用多行输入,命令是:{
以启动它,:}
以结束它。
这里的例子
Prelude> :{
Prelude| let beginsWithU (c:_) = c == 'u' || c == 'U'
Prelude| beginsWithU _ = False
Prelude| :}
Prelude> beginsWithU "umbrella"
True
Prelude> beginsWithU "mbrella"
False
我该怎么定义,在前奏
不能定义和前奏运行功能运行此功能。 Prelude是一个标准模块,随ghc附带的基础软件包一起提供。
假设你要定义并运行ghci
的代码,这是你必须做的事情:
λ> let beginsWithU (c:_) = c == 'u' || c == 'U'; beginsWithU _ = False
λ> beginsWithU "UHello"
True
你是什么意思“在前奏运行此功能”是什么意思? – Sibi