[Haskell-beginners] [Haskell-cafe] oddsFrom3 function
Daniel Trstenjak
daniel.trstenjak at gmail.com
Mon Aug 17 08:49:50 UTC 2015
Hi Debdut,
On Mon, Aug 17, 2015 at 04:44:55AM -0400, Debdut Karmakar wrote:
> I am a haskell beginner and wondering how the following function works (in
> procedure) :
>
>
> oddsFrom3 :: [Integer]
> oddsFrom3 = 3 : map (+2) oddsFrom3
>
>
> Thanks for your help.
Try to expand a few steps of the recursion by hand e.g.:
3 : (map (+2) (3 : map (+2) (3 : map (+2) ...)))
As you can see, the deeper you go more 'map (+2)' are applied to '3'.
Greetings,
Daniel
More information about the Beginners
mailing list