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: take
Type: Int -> [a] -> [a]
Description: creates a list, the first argument determines, how many items should be taken from the list passed as the second argument
Related: cycle, iterate, repeat, replicate

Example 1

Input: take 5 [1,2,3,4,5,6,7]

Output: [1,2,3,4,5]

Example 2

Input: take 5 [1,2]

Output: [1,2]

Example 3

Input: take 0 [1,2,3,4,5,6,7]

Output: []

Example 4

Input: take 5 (repeat 3)

Output: [3,3,3,3,3]

Example 5

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

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

Example 6

Input: take 10 (cycle [1,2,3])

Output: [1,2,3,1,2,3,1,2,3,1]




_____________________________________________
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
Domain Names conference call service UNLIMITED Web Hosting by HostDepartment Alojamiento Web answering service
MSN VoIP Internettelefonie Hosted Exchange, SDSL VoIP Internettelefonie AT VoIP Internettelefonie DE