# replace_part 関数

ある位置の部分を置き換えたリスト。位置 -> 値 と書きます。

## 書き方

### replace_part(list, rule)

**list**

リスト。リストを受け取ります。

**rule**

位置と新しい値。位置 -> 値 と書きます。規則を受け取ります。

## 例題

- $\displaystyle \operatorname{replace\_part}(\left[ 1, 2, 3 \right], 2 \to 9) = \left[ 1, 9, 3 \right]$

  `replace_part([1, 2, 3], 2 -> 9)`

  ソルバーでは、`replace_part([1, 2, 3], 2 -> 9)` の答えは `[1, 9, 3]` です。

  [ソルバーで開く](https://ja.hilberon.com/?q=replace_part%28%5B1%2C%202%2C%203%5D%2C%202%20-%3E%209%29)

## 関連する関数

- [part](https://ja.hilberon.com/library/part)

  位置でリストの要素を取り出す。1から数える。list\[i\] とも書く。
- [rest](https://ja.hilberon.com/library/rest)

  最初の要素を取り除いたリスト。
- [range](https://ja.hilberon.com/library/range)

  範囲内の整数をリストとして返します。
- [reverse](https://ja.hilberon.com/library/reverse)

  逆順にしたリスト。
- [prepend](https://ja.hilberon.com/library/prepend)

  先頭に要素を追加したリスト。
- [riffle](https://ja.hilberon.com/library/riffle)

  要素の間に値を挟んだリスト。

---
Source: https://ja.hilberon.com/library/replace_part
