Yes! That’s such as fun presentation!
For those who want the fast version, skip to 6:00 mark.
Silas
On 23 Feb 2022, at 00:48, Will Senn
<will.senn(a)gmail.com> wrote:
My all time favorite presentation on tail-recursion:
https://www.youtube.com/watch?v=-PX0BV9hGZY
On 2/22/22 4:39 AM, Ralph Corderoy wrote:
Hi Otto,
MacOS uses the GNU implementation which has a
long standing issue with
deep recursion. It even cannot handle the tail recursive calls used
here and will run out of its stack.
When learning dc and seeing it relied on tail calls, the first thing
I did was check it did tail-call elimination, and it did. That was
GNU dc.
Trying just now, I see no growth in memory usage despite heavy CPU load
shown by TIME increasing.
$ dc
!ps u `pidof dc`
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ralph 11489 0.0 0.0 2332 1484 pts/1 S+ 10:33 0:00 dc
[lmx]smlmx
^C
Interrupt!
!ps u `pidof dc`
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ralph 11489 75.5 0.0 2332 1488 pts/1 S+ 10:33 0:46 dc
The memory used remained at that level during the macro execution too,
watched from outside.
Do you have more detail on what GNU dc can't handle? dc without
tail-call elimination is a bit crippled.
_______________________________________________
COFF mailing list
COFF(a)minnie.tuhs.org
https://minnie.tuhs.org/cgi-bin/mailman/listinfo/coff