/**
 * Given a tuple 'tpl', an index 'index', and a value 'value', modify the tuple at the specified index with the given value.
 *
 * @param tpl The input tuple.
 * @param index The index at which to modify the tuple.
 * @param value The value to replace in the tuple at the specified index.
 * @return The modified tuple.
 *
 * Example:
 * modifyTuple(listOf('a', 'b', 'c', 'd'), 2, 'x')
 * Output: ('a', 'b', 'x', 'd')
 */
fun modifyTuple(tpl: List<Any>, index: Int, value: Any): List<Any> {

    // Convert the tuple to a mutable list
    val tplList = tpl.toMutableList()

    // Modify the value at the specified index
    tplList[index] = value

    // Return the modified list
    return tplList
}
/**
 * Given a tuple 'tpl', an index 'index', and a value 'value', modify the tuple at the specified index with the given value.
 *
 * @param tpl The input tuple.
 * @param index The index at which to modify the tuple.
 * @param value The value to replace in the tuple at the specified index.
 * @return The modified tuple.
 *
 * Example:
 * modifyTuple(listOf('a', 'b', 'c', 'd'), 2, 'x')
 * Output: ('a', 'b', 'x', 'd')
 */
fun modifyTuple(tpl: List<Any>, index: Int, value: Any): List<Any> {
/**
 * Given a tuple 'tpl', an index 'index', and a value 'value', modify the tuple at the specified index with the given value.
 *
 * @param tpl The input tuple.
 * @param index The index at which to modify the tuple.
 * @param value The value to replace in the tuple at the specified index.
 * @return The modified tuple.
 *
 * Example:
 * modifyTuple(listOf('a', 'b', 'c', 'd'), 2, 'x')
 * Output: ('a', 'b', 'x', 'd')
 */
fun modifyTuple(tpl: List<Any>, index: Int, value: Any): List<Any> {

    // Convert the tuple to a mutable list
    val tplList = tpl.toMutableList()

    // Modify the value at the specified index
    tplList[index] = value

    // Return the modified list
    return tplList
}