Skip to content

Instantly share code, notes, and snippets.

@aalvesjr
Last active December 14, 2015 01:39
Show Gist options
  • Save aalvesjr/5007530 to your computer and use it in GitHub Desktop.
Save aalvesjr/5007530 to your computer and use it in GitHub Desktop.
Exemplo de programação funcional em Ruby
multiple = -> num_one {
return -> num_two {
num_one * num_two
}
}
# => Proc
double = multiple.call 2
# => Proc
triple = multiple.call 3
# => Proc
ten_double = double.call 10
# => 20
six_double = double.call 6
# => 12
five_triple = triple.call 5
# => 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment