Method: Immutable::Vector#drop
- Defined in:
- lib/immutable/vector.rb
#drop(n) ⇒ Vector
Drop the first n elements and return the rest in a new Vector.
711 712 713 714 715 716 |
# File 'lib/immutable/vector.rb', line 711 def drop(n) return self if n == 0 return self.class.empty if n >= @size raise ArgumentError, "attempt to drop negative size" if n < 0 self.class.new(flatten_suffix(@root, @levels * BITS_PER_LEVEL, n, [])) end |