Created
December 21, 2014 08:03
-
-
Save anonymous/a2a784c9f37b1fc6b753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Depth of nesting | |
N = 100 | |
# Number of floats to allocate | |
M = 100_000 | |
def chain(next_lambda) | |
lambda { | |
puts "." | |
(1..M).to_a.map { rand } | |
next_lambda.call | |
} | |
end | |
the_chain = lambda { puts '.' } | |
N.times do |i| | |
the_chain = chain(the_chain) | |
end | |
the_chain.call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment