- 論壇徽章:
- 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 環(huán)境中,可以用但寫在源文件里再編譯就會失敗。下面是我的代碼
- 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 也沒問題。為啥會這樣呢? |
|