Skip to content

Instantly share code, notes, and snippets.

@404pnf
Forked from thatrubylove/lispy-ruby-example-1.rb
Created June 18, 2014 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 404pnf/b3505638d516b7d9caa6 to your computer and use it in GitHub Desktop.
Save 404pnf/b3505638d516b7d9caa6 to your computer and use it in GitHub Desktop.
# 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