Created
April 30, 2014 04:35
-
-
Save thatrubylove/744e8e3a59d5ab5f1fc6 to your computer and use it in GitHub Desktop.
LISPy code as data in 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
# 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