LoginSignup
0
0

More than 1 year has passed since last update.

[py2rb] insert

Last updated at Posted at 2021-12-20

はじめに

移植やってます

insert (Python)

parsed_sequence.insert(0, nterm)

リストの0番目にntermを挿入します。
今回は先頭に追加の意味になります。

unshift (Ruby)

parsed_sequence.unshift(nterm)

0番目以外だと大変でした。
[追記]
コメント欄にて教えていただいたのですが、rubyにもinsertありました。

parsed_sequence.insert(0, nterm)

@obelisk68 さん、ありがとうございました。

メモ

  • Python の insert を学習した
  • 道のりは遠そう
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0