Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created October 11, 2010 11:03
Show Gist options
  • Save yitsushi/620358 to your computer and use it in GitHub Desktop.
Save yitsushi/620358 to your computer and use it in GitHub Desktop.
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