Last active
December 30, 2020 20:40
-
-
Save sritchie/8dea6507051bc485246a98a1877c1e70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Here is the smoking gun... | |
(define (f x) | |
(lambda (cont) | |
(cont (lambda (y) (* x y)) | |
(lambda (g) (g x))))) | |
;; (D f) is: | |
(lambda (cont) | |
(cont (lambda (y) (+ x y)) | |
(lambda (g) (g x)))) | |
;; If I pass the first function into the second in the continuation, the whole | |
;; thing acts like (+ x x). So this should equal 10: | |
(((d f) 5) (lambda (f1 f2) (f2 f1))) | |
;; but in fact errors, due to equation (24d) in the paper. In fact, it passes if | |
;; you take Sussman's suggestion and implement tag replacement for functions as | |
;; identity! | |
;; | |
;; (But then of course your careful Church-boxed example fails.) | |
;; | |
;; Further notes from my investigation: | |
;; | |
;; This fails now because `f1` and `f2` both RETURN | |
;; differentials that have closed over the required `new` | |
;; tag from the outermost scope. | |
;; | |
;; On the way out, when the outer scope tries to swap `new` | |
;; back in for `old`, we get an error. The line that does | |
;; this is: | |
;; | |
;; (replace-differential-tag oldtag newtag) | |
;; | |
;; in `scmutils`, inside of `replace-dx-function`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output from latest
scmutils
: