Add replicate to base/Data.List.

This commit is contained in:
Michael Morgan 2019-10-29 16:06:48 -07:00
parent ab98b4d3c9
commit 9190ccf883

View File

@ -121,6 +121,13 @@ public export
reverse : List a -> List a
reverse = reverseOnto []
||| Construct a list with `n` copies of `x`.
||| @ n how many copies
||| @ x the element to replicate
public export
replicate : (n : Nat) -> (x : a) -> List a
replicate Z _ = []
replicate (S n) x = x :: replicate n x
||| Compute the intersect of two lists by user-supplied equality predicate.
export