Skip to content

Instantly share code, notes, and snippets.

@jeffp
Created April 8, 2010 20:19
Show Gist options
  • Save jeffp/360490 to your computer and use it in GitHub Desktop.
Save jeffp/360490 to your computer and use it in GitHub Desktop.
# use inner_array for index
mapped_array = array.inject([]){|inner_array, value| inner_array << map_op(value, inner_array.size)}
#as long as each iteration pushes one item on to the inner_array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment