Getting tuple of indices in Julia – to_indices() Method
The to_indices() is an inbuilt function in julia which is used to convert the given tuple I to a tuple of indices for use in indexing into array A.
Syntax: to_indices(A, I::Tuple)
Parameters:
- A: Specified array
- I: Specified tuple
Returns: It returns the converted tuple of indices.
Example 1:
# Julia program to illustrate # the use of to_indices() method # Getting the converted tuple of indices A = [1, 2, 3, 4]; t = (10, 20, 30, 40); println(to_indices(A, t)) |
chevron_right
filter_none
Output:
(10, 20, 30, 40)
Example 2:
# Julia program to illustrate # the use of to_indices() method # Getting the converted tuple of indices A = [1, 2]; t = (5, 10, 15, 20, 25); println(to_indices(A, t)) |
chevron_right
filter_none
Output:
(5, 10, 15, 20, 25)

