- The red metacoder side of a mad betacoder scientist - My lab for brainstorming and challenges in Ruby and Metaprogramming
- The red metacoder side of a mad betacoder scientist -
inc = lambda do |x| eval "#{x} += 1" end a = 5 inc[:a] puts a #=> 6
def inc(&blk) eval "#{yield} += 1", blk end x = 5 inc {:x} puts x #=> 6
No comments:
Post a Comment