Created
September 28, 2012 14:44
-
-
Save aweis/3800293 to your computer and use it in GitHub Desktop.
Functional Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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