HH\Lib\Vec\drop
Returns a new vec containing all except the first $n
elements of the
given Traversable
namespace HH\Lib\Vec;
function drop<Tv>(
Traversable<Tv> $traversable,
int $n,
): vec<Tv>;
To take only the first $n
elements, see Vec\take()
.
Time complexity: O(n), where n is the size of $traversable
Space complexity: O(n), where n is the size of $traversable
Parameters
Traversable<Tv>
$traversable
int $n
Returns
vec<Tv>
Examples
$example_vec = vec[1,2,3,4,5];
$result = Vec\drop($example_vec, 3);
print_r($result);
//result: [4,5]
$result = Vec\drop($example_vec, 0);
print_r($result);
//result: [1,2,3,4,5]