Element Operations
Pick Element
Module
UTCGP.element_pick — Module
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
Functions
UTCGP.element_pick.pick_element_from_vector — Function
pick_element_from_vector(vec::Vector{<:Any}, at::Int, args...)Returns the element in vec at at index.
julia> pick_element_from_vector([1,2,3,4], 2)
2julia> 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]
[...]UTCGP.element_pick.pick_last_element — Function
pick_last_element(vec::Vector{<:Any}, args...)Returns the element last element in vec. Throws BoundsError if the vector is empty
julia> pick_last_element([1,2,3,4])
4julia> 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]
[...]