Created
December 20, 2011 20:09
-
-
Save kbaird/1503059 to your computer and use it in GitHub Desktop.
Nerdy syntactic sugar to allow the Greek letter lambda for Procs 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
# encoding: UTF-8 | |
module Kernel | |
alias_method :λ, :lambda | |
end | |
=begin | |
Allows code like this, using the actual Greek λ character: | |
add1 = λ { |x| x + 1 } | |
puts "add1.call(2) = " + add1.call(2).to_s + "\n" | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment