replace_at 函数
替换一基列表位置上的元素。
语法
replace_at(list, index, item)ReplaceAt(list, index, item)
参数与选项
list | 形如 [1, 2, 3] 的列表字面量。 |
|---|---|
index | 要替换的一基位置。 |
item | 替换后的元素。 |
示例
- 替换元素
replace_at([x, q, z], 2, y)返回 [x, y, z]。
替换一基列表位置上的元素。
replace_at(list, index, item)ReplaceAt(list, index, item)list | 形如 [1, 2, 3] 的列表字面量。 |
|---|---|
index | 要替换的一基位置。 |
item | 替换后的元素。 |
replace_at([x, q, z], 2, y)返回 [x, y, z]。