ZVON > References > Haskell reference
| 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]




_____________________________________________
Reference Search | Sitemap | XML Glossary       ZVON | Systinet




Related sites:
  • dotNet Slackers - Your latest resource for ASP.NET
  • Dotnet Spider - Outsourcing and Offshore software development in India
  • XML - Xselerator, XSL Editor, BizTalk Utilities, XML Tutorials, Learn XML
  • Planet Source Code - The largest public source code database on the Internet
conference call service VoIP Internettelefonie DSL, SDSL, ADSL answering service