query
On this page

replicate

lib.replicate

Docs pulled from | This Revision | 10 minutes ago


Return a list with n copies of an element.

Inputs

n

1. Function argument

elem

2. Function argument

Type

replicate :: int -> a -> [a]

Examples

lib.lists.replicate usage example

replicate 3 "a"
=> [ "a" "a" "a" ]
replicate 2 true
=> [ true true ]
(lib.lists.replicate)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

replicate = n: elem: genList (_: elem) n;