Skip to content

Instantly share code, notes, and snippets.

@niku
Created May 14, 2012 05:36
Show Gist options
  • Save niku/2691984 to your computer and use it in GitHub Desktop.
Save niku/2691984 to your computer and use it in GitHub Desktop.
def plus5div2 ary
plus5 = ->(input){ input + 5 }
div2 = ->(input){ input / 2 }
ary.map(&plus5).map(&div2)
end
plus5div2 [2, 4, 5, 3] # => [3, 4, 5, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment