replicate
lib.lists.replicate
Docs pulled from | This Revision | 16 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 ]
Noogle detected
Implementation
The following is the current implementation of this function.
replicate = n: elem: genList (_: elem) n;