Skip to content

Instantly share code, notes, and snippets.

@jballanc
Created June 25, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jballanc/1734f3a735b62c89908b51bb375d6c3e to your computer and use it in GitHub Desktop.
Save jballanc/1734f3a735b62c89908b51bb375d6c3e to your computer and use it in GitHub Desktop.
function f(x)
if x > 0
unshift!(f(x-1), 1)
else
[1]
end
end
function crash(low, i, high)
try
println("Trying $i")
f(i)
crash(i, i + ((high-i)÷2), high)
catch StackOverflow
if i == high
println("No crash")
else
crash(low, low + ((i-low)÷2), i)
end
end
end
crash(i) = crash(0, i/2, i)
crash(10000000)
#crash(0,108812,1000000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment