Auto-vivifying hashes in Ruby

An auto-vivifying hash is a hash that lets you create sub-hashes automatically. This means that the following code becomes possible: 1 2 3 4 5 6 def cnh # silly name "create nested hash" Hash.new {|h,k| h[k] = Hash.new(&h.default_proc)} end my_hash = cnh my_hash[1][2][3] = 4 my_hash # => { 1 => { 2 => { 3 => 4 } } } This is useful because it reduces the amount of logic in the code.

Closures in Ruby

I found a <a href="http://innig.net/software/ruby/closures-in-ruby.rb">script</a> that explains everything really well. Credit goes to: Along with <a href="http://eli.thegreenplace.net/2006/04/18/understanding-ruby-blocks-procs-and-methods/">this blog entry</a>, it's made the whole deal much easier to figure out. Now.. Why didn't I get that when I was looking at LISP?

Extending Ruby for Fun and Profit

Wow. I just watched Dave Thomas' talk <a href="http://www.infoq.com/presentations/metaprogramming-ruby">Ruby Metaprogramming: Extending Ruby for Fun and Profit</a> and it explained so many things. It's quite worth watching if you like Ruby and don't know about metaprogramming and Ruby hooks and what 'self' means, fully.

Why do I study martial arts?

I am watching Rocky III and IV (the only ones I really like), and the driving theme is the power of the human spirit. Rewatching it now, I see a lot of other ideas. They're not particularly hidden, but I never really noticed them before. This started to make me think about my choices. My lasting decision to study martial arts was made in college, and I took a Physical Education class of self-defense taught by shifu Christopher Goedecke, who studies and teaches isshin kempo.