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: | map |
Type: | (a -> b) -> [a] -> [b] |
Description: | returns a list constructed by appling a function (the first argument) to all items in a list passed as the second argument |
Related: | |
Keywords: | list calculation, list construction |
Input: map abs [-1,-3,4,-12]
Output: [1,3,4,12]
Input: map reverse ["abc","cda","1234"]
Output: ["cba","adc","4321"]
Input: map (3*) [1,2,3,4]
Output: [3,6,9,12]
Input: map (recip . negate) [1,4,-5,0.1]
Output: [-1.0,-0.25,0.2,-10.0]
Input: map (print) [1,3,5,6,7]
Output: [<<IO action>>,<<IO action>>,<<IO action>>,<<IO action>>,<<IO action>>]