Consider the code at the end of this post. un-commenting f-scope reveals the compiler error:
;;; ERROR: unbound lexical #<tree-il (lexical x #{x 190}#)> But without it the globalified versoin f-scope2 comiles just fine indicating an error in the compiler. Regards Stefan (define-syntax-rule (<p-lambda> (c) code ...) (lambda (a b cc d c) code ...)) (define-syntax .. (syntax-rules () ((.. (f a ...)) (f x y z a ...)) ((.. (s ...) (f a ...)) (f x y z a ...)))) #; (define (f-scope f) (define (g f x3) (define (h x2 n m) (lambda xx (apply (f-skip n m) x2))) (<p-lambda> (c) (.. (c2) (f c)) (let ((n N) (m M)) (.. ((h x3 n m) c2))))) (lambda x (apply (g f x) x))) (define (h x2 n m) (lambda xx (apply (f-skip n m) x2))) (define (g f x3) (<p-lambda> (c) (.. (c2) (f c)) (let ((n N) (m M)) (.. ((h x3 n m) c2))))) (define (f-scope2 f) (lambda x (apply (g f x) x)))