Skip to main content

Mojo function

fill_like

fill_like(src: IntTuple[origin], val: Int) -> IntTuple

Creates an IntTuple with the same structure as the source but filled with a specified value.

This function recursively traverses the source IntTuple and creates a new IntTuple with identical structure, but with all leaf values replaced by the specified value.

Args:

  • src (IntTuple): The source IntTuple whose structure will be copied.
  • val (Int): The integer value to fill the new IntTuple with.

Returns:

IntTuple: A new IntTuple with the same structure as src but filled with val.

Was this page helpful?