Element Operations

Pick Element

Module

UTCGP.element_pickModule

Pick one element from a vector.

The type returned depends on the type of the element at a certain index.

Exports :

  • bundle_element_pick :
    • pick_element_from_vector
source

Functions

julia> pick_element_from_vector([1,2,3,4], 2)
2
julia> pick_element_from_vector(["a","b","c"], 3)
"c"
julia> pick_element_from_vector([1,2,3,4], 0)
ERROR: BoundsError: attempt to access 4-element Vector{Int64} at index [0]
[...]
julia> pick_last_element([1,2,3,4])
4
julia> pick_last_element([(1,2),(2,2)])
(2, 2)
julia> pick_last_element([])
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [0]
[...]