Skip to content

Instantly share code, notes, and snippets.

@reinh
Created June 7, 2013 18:14
Show Gist options
  • Save reinh/5731241 to your computer and use it in GitHub Desktop.
Save reinh/5731241 to your computer and use it in GitHub Desktop.
# A bunny has three offspring each generation.
generation = -> (x) { [x,x,x] }
# How many bunnies will there be after two generations?
["bunny"].flat_map(&generation).flat_map(&generation).length # => 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment