Skip to content

Instantly share code, notes, and snippets.

@aweis
Created September 28, 2012 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aweis/3800293 to your computer and use it in GitHub Desktop.
Save aweis/3800293 to your computer and use it in GitHub Desktop.
Functional Ruby
#metaprogramming
class Array
def tail
head, *tail = self
return tail
end
def head
head, *tail = self
return head
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment