diff --git a/direct-style-interpreter.scm b/direct-style-interpreter.scm index b0e8b4f..87d2209 100644 --- a/direct-style-interpreter.scm +++ b/direct-style-interpreter.scm @@ -213,28 +213,26 @@ (define-primitive + + 2) (define-primitive = = 2) (define-initial call/cc - (let* ([arity 1] - [arity+1 (1+ arity)]) - (make-closure - (lambda (v* sr) - (if (= arity+1 (activation-rec-length v*)) - (call/cc ;; call/cc is "magic" for our purposes here, - ;; there are no reified continuations in the denotation - (lambda (k) - (invoke - (activation-rec-ref v* 0) - (let ([rec (make-activation-rec (+ 1 1))]) - (activation-rec-set! - rec 0 - (make-closure - (lambda (values r) - (if (= arity+1 (activation-rec-length values)) - (k (activation-rec-ref values 0)) - (error "Incorrect arity" 'continuation))) - (*env*))) - rec)))) - (error "Incorrect arity" 'call/cc))) - (*env*)))) + (make-closure + (lambda (v* sr) + (if (= (activation-rec-length v*) 2) + (call/cc ;; call/cc is "magic" for our purposes here, + ;; there are no reified continuations in the denotation + (lambda (k) + (invoke + (activation-rec-ref v* 0) + (let ([rec (make-activation-rec 2)]) + (activation-rec-set! + rec 0 + (make-closure + (lambda (values r) + (if (= (activation-rec-length values) 2) + (k (activation-rec-ref values 0)) + (error "Incorrect arity" 'continuation))) + (*env*))) + rec)))) + (error "Incorrect arity" 'call/cc))) + (*env*))) (define-initial apply (make-closure (lambda (v* sr)