- 论坛徽章:
- 0
|
我在看 yaht, 下面是其中一个习题
Exercise 3.3 Use map to convert a string into a list of booleans, each element in the
new list representing whether or not the original element was a lower-case character.
That is, it should take the string “aBCde” and return [True,False,False,True,True].
我在 ghci 环境中,可以用但写在源文件里再编译就会失败。下面是我的代码
- module Main
- where
- main = do
- x<-getLine
- putStrLn $ show $ map Char.isLower x
复制代码 编译时报告如下错误
3.3.hs:6:25: Not in scope: `Char.isLower'
如果先 import Char,则上面的代码可以通过,而且把 map Char.isLower 替换成 map isLower 也没问题。为啥会这样呢? |
|