-
-
Save teeparham/7f162dbc2bb0ea2f3f2e to your computer and use it in GitHub Desktop.
Functional Ruby
This file contains hidden or 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
# define a closure x that exposes function y | |
x = -> { | |
y = -> { puts "y" }; | |
{ y: y } | |
} | |
# invoke public function y on x | |
x.()[:y].() | |
# alternately | |
x.call[:y].call | |
# => not pretty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment