Actions
Feature #15730
closedAdd map_with_index method
Status:
Closed
Assignee:
-
Target version:
-
Description
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.
Actions
Like0
Like0Like0Like0