Find limit of recursion: Difference between revisions

Content added Content deleted
(→‎{{header|Julia}}: A new entry for Julia)
Line 1,719: Line 1,719:


=={{header|Rust}}==
=={{header|Rust}}==
<lang rust>fn recurse(n: i32) {
Rust 0.8:
println!("depth: {}", n);
<lang rust>fn recurse(n: int) {
println(fmt!("deep: %?", n));
recurse(n + 1)
recurse(n + 1);
}
}


fn main() {
fn main() {
recurse(0);
recurse(0);
}</lang>
}</lang>
Run:
<pre>...
deep: 7892
Segmentation fault</pre>


{{out}}
Rust 0.9:
<lang rust>fn recurse(n: int) {
println!("deep: {:d}", n);
recurse(n + 1);
}

fn main() {
recurse(0);
}</lang>
Run:
<pre>...
<pre>...
depth: 18433
deep: 12952
depth: 18434
depth: 18435


thread '<main>' has overflowed its stack
An unknown error occurred


To learn more, run the command again with --verbose.</pre>
There are not many persons who know what wonders are opened to them in the
stories and visions of their youth; for when as children we listen and dream,
we think but half-formed thoughts, and when as men we try to remember, we are
dulled and prosaic with the poison of life. But some of us awake in the night
with strange phantasms of enchanted hills and gardens, of fountains that sing
in the sun, of golden cliffs overhanging murmuring seas, of plains that stretch
down to sleeping cities of bronze and stone, and of shadowy companies of heroes
that ride caparisoned white horses along the edges of thick forests; and then
we know that we have looked back through the ivory gates into that world of
wonder which was ours before we were wise and unhappy.

fatal runtime error: assertion failed: !ptr.is_null()
Aborted
</pre>

Run (rust 0.12):
<pre>...
deep: 8596

task '<main>' has overflowed its stack
</pre>


=={{header|Sather}}==
=={{header|Sather}}==