-
-
Save 404pnf/b3505638d516b7d9caa6 to your computer and use it in GitHub Desktop.
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
# treating a function as data | |
putter = ->(message) { puts message } | |
def deliver_message(message, handler) | |
handler.(message) | |
end | |
deliver_message("Hello, code as data!", putter) | |
# => Hello, code as data! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment