浏览 1474 次
锁定老帖子 主题:RWH CH01 Notes
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-08-04
最后修改:2010-08-04
Haskell is lazy evaluation!
Prelude> :show bindings Prelude> let x = 2010 Prelude> :show bindings x :: Integer = _ Prelude> x 2010 Prelude> :show bindings it :: Integer = 2010 x :: Integer = 2010 Prelude>
Exercises Answers:
3: The words function counts the number of words in a string. Modify the WC.hs example to count the number of words in a file.
main = interact wordCount where wordCount input = show (length (words input)) ++ "\n"
4: Modify the WC.hs example again, to print the number of characters in a file.
main = interact wordCount where wordCount input = show (length input) ++ "\n" Useful command
:set +t
:unset +t
:m Data.Radio
it
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |