Module: DaruLite::Vector::Joinable
- Included in:
- DaruLite::Vector
- Defined in:
- lib/daru_lite/vector/joinable.rb
Instance Method Summary collapse
-
#concat(element, index) ⇒ Object
(also: #push, #<<)
Append an element to the vector by specifying the element and index.
Instance Method Details
#concat(element, index) ⇒ Object Also known as: push, <<
Append an element to the vector by specifying the element and index
5 6 7 8 9 10 11 12 |
# File 'lib/daru_lite/vector/joinable.rb', line 5 def concat(element, index) raise IndexError, 'Expected new unique index' if @index.include? index @index |= [index] @data[@index[index]] = element update_position_cache end |