Getting started with Haskell-2

博客分类: 技术 阅读次数: comments

Getting started with Haskell-2

高阶函数

这两者可以接参数,也可以作为函数定义。

Prelude> prod = (\x y -> x*y)
Prelude> :t prod
prod :: Num a => a -> a -> a

惰性求值(迭代器)

my_range.hs

*Main> take 10 (myRange 1 2)
[1,3,5,7,9,11,13,15,17,19]

lazy_fib.hs