Skip to content

Instantly share code, notes, and snippets.

@alindeman
Forked from mtodd/array_recursive_reverse.rb
Created December 16, 2010 12:59
Show Gist options
  • Save alindeman/743366 to your computer and use it in GitHub Desktop.
Save alindeman/743366 to your computer and use it in GitHub Desktop.
class Array
def recursive_reverse
return self if empty?
[pop, *recursive_reverse]
end
end
puts [1,2,3,4].recursive_reverse.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment