Here's a slight clean up of 'ac' (define (ac s env)
(let ((head (xcar s)))
(cond ((string? s) (string-copy s)) ; to avoid immutable strings
((literal? s) s)
((eqv? s 'nil) (list 'quote 'nil))
((ssyntax? s) (ac (expand-ssyntax s) env))
((symbol? s) (ac-var-ref s env))
((ssyntax? head) (ac (cons (expand-ssyntax head) (cdr s)) env))
((eq? head 'quote) (list 'quote (ac-niltree (cadr s))))
((eq? head 'quasiquote) (ac-qq (cadr s) env))
((eq? head 'if) (ac-if (cdr s) env))
((eq? head 'fn) (ac-fn (cadr s) (cddr s) env))
((eq? head 'set) (ac-set (cdr s) env))
; this line could be removed without changing semantics
((eq? (xcar head) 'compose) (ac (decompose (cdar s) (cdr s)) env))
((pair? s) (ac-call (car s) (cdr s) env))
(#t (err "Bad object in expression" s)))))
|