Skip to content
Tail-Call Optimization
step 1/5

Reading — step 1 of 5

Read

~1 min readAdvanced Topics

Tail-Call Optimization

The problem:

(define (loop n)
   (if (= n 0)
       "done"
       (loop (- n 1))))

(loop 100000)   -> RecursionError

Every recursive call grows Python's call stack

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…