I fucking get DSLs now, I still don't get the finer points of scheme syntax stuff, but look at this:
(define-syntax numeric-sexp->dual
(syntax-rules (+ - expt * / sin cos tan)
[(_ (+ arg1 arg2 ...))
(dual-add (lift-sexp arg1) (lift-sexp arg2 ...))]
[(_ (+ arg1) ) (lift-sexp arg1)]
[(_ (- arg1 arg2 ...))
(dual-sub (lift-sexp arg1) (list-sexp arg2 ...))]
[(_ (expt base exponent) ) (dual-expt (lift-sexp base) (lift-sexp exponent))]
[(_ x) (if (number? x)
Comment too long. Click here to view the full text.