Created
December 5, 2020 23:12
-
-
Save tbenst/1d96d33fdfaf34136c7c1726b3f0d225 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function dummy0(x, continuation) | |
continuation(x * "will fail if x an integer") | |
end | |
function dummy1(x, continuation) | |
continuation(x, x->x) | |
end | |
# make functions dummy2, dummy3, ... | |
# continuation passing style to succintly make long stack trace | |
for i in 2:20 | |
func_name = Symbol("dummy$i") | |
func_name1 = Symbol("dummy$(i-1)") | |
func_name2 = Symbol("dummy$(i-2)") | |
eval(quote | |
$func_name(x, continuation) = $func_name1(x, $func_name2) | |
end) | |
end | |
function dummy21(x) | |
dummy20(x, dummy19) | |
end | |
dummy21("Succeeds since we pass a string but ") | |
dummy21(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment