ZVON
>
References
>
Haskell reference |

Intro / Search / ZVON |

| Indexes | Syntax | >> Prelude << | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random |

Module: | Prelude |
---|---|

Function: | iterate |

Type: | (a -> a) -> a -> [a] |

Description: | creates an infinite list where the first item is calculated by applying the function on the secod argument, the second item by applying the function on the previous result and so on. |

Related: | cycle, repeat, replicate, take |

Example 1

**Input: **take 10 (iterate (2*) 1)

**Output: **[1,2,4,8,16,32,64,128,256,512]

Example 2

**Input: **take 10 (iterate (\x -> (x+3)*2) 1)

**Output: **[1,8,22,50,106,218,442,890,1786,3578]