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: foldl
Type: (a -> b -> a) -> a -> [b] -> a
Description: it takes the second argument and the first item of the list and applies the function to them, then feeds the function with this result and the second argument and so on. See scanl for intermediate results.
Related: foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1

Example 1

Input: foldl (/) 64 [4,2,4]

Output: 2.0

Example 2

Input: foldl (/) 3 []

Output: 3.0

Example 3

Input: foldl max 5 [1,2,3,4]

Output: 5

Example 4

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

Output: 7

Example 5

Input: foldl (\x y -> 2*x + y) 4 [1,2,3]

Output: 43




_____________________________________________
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