Find limit of recursion: Difference between revisions
Content deleted Content added
Logo: no limit |
+Icon+Unicon |
||
Line 142:
208923
Segmentation fault (core dumped)</lang>
== Icon and Unicon ==
==={{header|Icon}}===
<lang Icon>procedure main()
envar := "MSTKSIZE"
write(&errout,"Program to test recursion depth - dependant on the environment variable ",envar," = ",\getenv(envar)|&null)
deepdive()
end
procedure deepdive()
static d
initial d := 0
write( d +:= 1)
deepdive()
end</lang>
Note: The stack size environment variable defaults to about 50000 words. This terminates after approximately 3500 recursions (Windows). The interpreter should terminate with a 301 error, but currently this does not work.
==={{header|Unicon}}===
This Icon solution works in Unicon.
=={{header|J}}==
|