insert_into_nest_at_index#

ivy.insert_into_nest_at_index(nest, index, value)[source]#

Recursively inserts a value into a nested data structure at a specified index.

This function traverses a nested data structure and inserts the provided value at the specified index.

Parameters:
  • nest (Iterable) – The nested data structure.

  • index (Tuple) – The index specifying the location where the value should be inserted.

  • value (object) – The value to be inserted.

Return type:

None

Returns:

None

Examples

>>> nest = [[1, 2], [3, 4]]
>>> index = (1, 1)
>>> value = 99
>>> ivy.insert_into_nest_at_index(nest, index, value)
>>> print(nest)
[[1, 2], [3, 99, 4]]