How would you (re)implement iterate in Haskell?

前端 未结 2 1683
野趣味
野趣味 2021-02-05 17:46
iterate :: (a -> a) -> a -> [a]

(As you probably know) iterate is a function that takes a function and starting value. Then it ap

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 18:23

    Also note that you can find concise definitions for the range of basic Haskell functions in the report's Standard Prelude.

    Reading through this list of straightforward definitions that essentially bootstrap a rich library out of raw primitives can be very educational and eye-opening in terms of providing a window onto the "haskell way".

    I remember a very early aha moment on reading: data Bool = False | True.

提交回复
热议问题