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: replicate
Type: Int -> a -> [a]
Description: creates a list of length given by the first argument and the items having value of the second argument
Related: cycle, iterate, repeat, take

Example 1

Input: replicate 3 5

Output: [5,5,5]

Example 2

Input: replicate 5 "aa"

Output: ["aa","aa","aa","aa","aa"]

Example 3

Input: replicate 5 'a'

Output: "aaaaa"