Skip to content

Instantly share code, notes, and snippets.

@flash-gordon
Created July 8, 2013 16:54
Show Gist options
  • Save flash-gordon/5950494 to your computer and use it in GitHub Desktop.
Save flash-gordon/5950494 to your computer and use it in GitHub Desktop.
Infinite hash example
recursive_lambda = proc {|h, k| h[k] = Hash.new(&recursive_lambda)}
Hash.new(&recursive_lambda)
@flash-gordon
Copy link
Author

mh = Hash.new(&recursive_lambda)
mh[1][2][3] => {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment