Created
October 11, 2010 11:03
-
-
Save yitsushi/620358 to your computer and use it in GitHub Desktop.
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
def gen_log_base(base) | |
return Proc.new { |num| Math.log(num, base) } | |
end | |
log2 = gen_log_base(2) | |
log10 = gen_log_base(10) | |
puts log2.call(4) | |
puts log10.call(100) | |
=begin | |
Output: | |
2.0 | |
2.0 | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment