I ported @mattmight鈥檚 conversion code (matt.might.net/articles/cps-co) to and after some fighting with the type system, it worked! To make the work with the Cont monad, I had to remove recursive lets and hence, functions being able to call themselves recursively, but the rest works fine.

The attached images show the conversion of the Fibonacci function into the CPS version.

Fibonacci function in Lisp:

(let
  ([fib
     (位 (n)
       (let
         ([fib'
            (位 (n f)
              (if (= n 0)
                0
                (if (= n 1)
                  1 
                  (+ (f (- n 1) f) (f (- n 2) f)))))])
         (fib' n fib')))])
  (fib 10))CPS version of Fibonacci function in Lisp:

(let
  ([fib
     (位 (n k0)
       (let
         ([fib'
            (位 (n f k1)
              ((位 (k2)
                 ((位 (v3)
                    (if v3
                      (k2 0)
                      ((位 (k4)
                         ((位 (v5)
                            (if v5
                              (k4 1)
                              ((位 (v9)
                                 (f v9 f
                                   (位 (v6)
                                     ((位 (v8)
                                        (f v8 f 
                                          (位 (v7) 
                                            (k4 (+ v6 v7)))))
                                      (- n 2)))))
                               (- n 1))))
                          (= n 1)))
                       k2)))
                  (= n 0)))
               k1))])
         (fib' n fib' k0)))])
  (fib 10 return))
0

If you have a fediverse account, you can quote this note from your own instance. Search https://fantastic.earth/users/abnv/statuses/110501462848760540 on your instance and quote it. (Note that quoting is not supported in Mastodon.)