(define (ac-call fn args env) (let ((macfn (ac-macro? fn))) (if macfn (ac-mac-call macfn args env) (let ((afn (ac fn env)) (aargs (map (lambda (x) (ac x env)) args)) (nargs (length args))) (cond ((and (pair? fn) (eqv? (car fn) 'fn)) `(,afn ,@aargs)) ((and (>= nargs 0) (<= nargs 4)) `(,(string->symbol (string-append "ar-funcall" (number->string nargs))) ,afn ,@aargs)) (#t `(ar-apply ,afn (list ,@aargs))))))))