BLUE
Profile banner
JM
James Munns
@jamesmunns.com
Notable Protocol Enjoyer. Doing stuff, mostly in Rust and on Embedded systems. Need help with that? Hire me @ onevariable.com DMs (matrix): @jamesmunns:beeper.com DMs (signal): jamesmunns.255 DMs (here): open he/him Kein Ort für Nazis
959 followers433 following2.9k posts
JMjamesmunns.com

theres no joke here, it's just how you can cruise control to working recursive code, which is often very useful, even if there are probably better ways to do it. If you remember to terminate first, and recurse last, and try really hard to keep that consistent, usually the problem shakes out easy.

2

JMjamesmunns.com

it's also pretty much the structure you want if you have a language (or optimizer) that understands tail-chaining: you always want to recurse last, as that's basically what gets transformed into a tail chain/iterative approach anyway.

0
WDcr1901.bsky.social

Wonder if this'll help me transform the SICP "coin counting" problem from recursive to iterative...

1
Profile banner
JM
James Munns
@jamesmunns.com
Notable Protocol Enjoyer. Doing stuff, mostly in Rust and on Embedded systems. Need help with that? Hire me @ onevariable.com DMs (matrix): @jamesmunns:beeper.com DMs (signal): jamesmunns.255 DMs (here): open he/him Kein Ort für Nazis
959 followers433 following2.9k posts