Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.