List Generic Operations
Basic operations
Module
UTCGP.listgeneric_basic — Module
Basic Functions that apply to all lists
Exports : bundlelistgenericbasic: - identity_list - new_list - reverse_list
Functions
UTCGP.listgeneric_basic.identity_list — Function
Just return the list.
Generic function
julia> identity_list([1,2,3,4])
4-element Vector{Int64}:
1
2
3
4UTCGP.listgeneric_basic.new_list — Function
new_list(args...)Generates a new vector, the type will be Any so a caster should be used.
julia> new_list()
Any[]UTCGP.listgeneric_basic.reverse_list — Function
reverse_list(l::Vector{<:Any}, args...)Reverse the list without affecting the original list.
julia> reverse_list([1,2])
2-element Vector{Int64}:
2
1Subset functions
Module
UTCGP.listgeneric_subset — Module
Exports :
- bundle_listgeneric_subset :
pick_from_exclusive_genericpick_from_inclusive_genericpick_until_exclusive_genericpick_until_inclusive_genericsubset_list_of_tuplessubset_by_masksubset_by_indices
Functions
UTCGP.listgeneric_subset.pick_from_exclusive_generic — Function
pick_from_exclusive_generic(
list_gen::Vector{T},
from_i::Int,
args...,
)Subsets a list from (exclusive) until the end of the list
In principle, from_i can also be negative.
UTCGP.listgeneric_subset.pick_from_inclusive_generic — Function
pick_from_inclusive_generic(
list_gen::Vector{T},
from_i::Int,
args...,
)Subsets a list from (inclusive) until the end of the list
In principle, from_i can also be negative, it will return the vector from the first index.
julia> pick_from_inclusive_generic([1,2,3,4], -1)
4-element Vector{Int64}:
1
2
3
4julia> pick_from_inclusive_generic([1,2,3,4], 2)
3-element Vector{Int64}:
2
3
4julia> pick_from_inclusive_generic([1,2,3,4], 10)
Int64[]UTCGP.listgeneric_subset.pick_until_exclusive_generic — Function
pick_until_exclusive_generic(
list_gen::Vector{T},
until_i::Int,
args...,
)Subsets a list from the beginning until (exclusive) a given index
In principle, until_i can also be negative
UTCGP.listgeneric_subset.pick_until_inclusive_generic — Function
pick_until_inclusive_generic(
list_gen::Vector{T},
until_i::Int,
args...,
)Subsets a list from the beginning until (inclusive) a given index
In principle, until_i can also be negative
Make Lists from elements
Module
UTCGP.listgeneric_makelist — Module
Make vectors from elements of the same type
Exports : bundle_listgeneric_makelist:
make_list_from_one_elementmake_list_from_two_elementsmake_list_from_three_elements
Functions
UTCGP.listgeneric_makelist.make_list_from_one_element — Function
make_list_from_one_element(e1::T, args...)Makes [e1]
julia> make_list_from_one_element(12344)
1-element Vector{Int64}:
12344UTCGP.listgeneric_makelist.make_list_from_two_elements — Function
make_list_from_two_elements(e1::T, e2::T, args...)Makes [e1,e2]
julia> make_list_from_two_elements("ju","lia")
2-element Vector{String}:
"ju"
"lia"Elements have to be of the same type (also applies for make_list_from_three_elements) :
julia> make_list_from_two_elements("juli",'a')
ERROR: MethodError: no method matchingUTCGP.listgeneric_makelist.make_list_from_three_elements — Function
make_list_from_three_elements(e1::T, e2::T, e3::T, args...)Makes [e1,e2,e3]
julia> make_list_from_three_elements("ju", "l", "ia")
3-element Vector{String}:
"ju"
"l"
"ia"Concat Operation
Module
UTCGP.listgeneric_concat — Module
Union of lists
Exports :
- bundle_listgeneric_concat :
concat_two_lists
Functions
UTCGP.listgeneric_concat.concat_two_lists — Function
list_concat(list_a::Vector{T}, list_b::Vector{T}, args...)Concats two lists, should be of the same type.
Although the types of the lists elements are not enforced.
T is a generic type.
julia> concat_two_lists([1,2], [3,4])
4-element Vector{Int64}:
1
2
3
4But lists have to be of the same type:
julia> concat_two_lists([1,2], [3.0,4.0])
ERROR: MethodError: no method matching
[...]