In functional algorithms, it is common to pass a context down recursive calls. In Haskell-like languages, this is done like:
foo (App fun arg) ctx = App (foo fun ctx) (foo arg ctx)
This inoffensive-looking line can have harsh performance implications, specially