A.Vector.duplicate

You're seeing just the function duplicate, go back to A.Vector module for more information.

Specs

duplicate(val, non_neg_integer()) :: t(val) when val: value()

Duplicates the given element n times in a vector.

n is an integer greater than or equal to 0. If n is 0, an empty list is returned.

Runs in logarithmic time regarding n. It is very fast and memory efficient (see Memory usage).

Examples

iex> A.Vector.duplicate(nil, 10)
vec([nil, nil, nil, nil, nil, nil, nil, nil, nil, nil])
iex> A.Vector.duplicate(:foo, 0)
vec([])