LoginSignup
0
0

More than 1 year has passed since last update.

[py2rb] itertools.chain

Last updated at Posted at 2021-12-21

はじめに

移植やってます

itertools.chain (Python)

import itertools

for i in itertools.chain([x.end() for x in re.finditer(rule, sequence)], [None]):

extendと似ていますが、こちらは平坦化も行っています。

flatten (Ruby)

[sequence.scan(rule).map { sequence.index(_1) + _1.size } + [nil]].flatten.each do |i|
end

平坦化といえばflatten

メモ

  • Python の itertools.chain を学習した
  • 道のりは遠そう
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