From: jzakiya@... Date: 2019-03-27T16:58:25+00:00 Subject: [ruby-core:92013] [Ruby trunk Feature#15730] Add map_with_index method Issue #15730 has been reported by jzakiya (Jabari Zakiya). ---------------------------------------- Feature #15730: Add map_with_index method https://bugs.ruby-lang.org/issues/15730 * Author: jzakiya (Jabari Zakiya) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I was converting some Ruby code to Crystal on Rosetta Code and came across this Ruby snippet, ``` arry.each_with_index.map{ |x,y| ......} ``` where ``arry`` is an array of integers. This wouldn't convert directly into Crystal (wouldn't compile). Looking at their ``enumerables`` methods they have ``map_with_index``, and that works. ``` arry.map_with_index{ |x,y| ......} ``` I don't know how frequently in Ruby this method combination exits, but I suspect it's somewhat common. I think this method makes a whole lot of logical sense, would optimize the concept, and makes reading code easier. Anyway, thanks for any consideration. -- https://bugs.ruby-lang.org/ Unsubscribe: