diff --git a/scheme-core/compiler.scm b/scheme-core/compiler.scm index 1a72244..2a0bf55 100644 --- a/scheme-core/compiler.scm +++ b/scheme-core/compiler.scm @@ -262,9 +262,12 @@ (endl (make-label g)) (test (cadr x)) (then (caddr x)) - (else (if (pair? (cdddr x)) - (cadddr x) - (void)))) + (else (cond ((null? (cdddr x)) + (void)) + ((null? (cddddr x)) + (cadddr x)) + (else + (error "compile error: if expects 2-3 arguments."))))) (cond ((eq? test #t) (compile-in g env tail? then)) ((eq? test #f)