cchooper, did you actually ever run your version? I can't make your orginal version work.
arc> (def-with-prefix pre foo (x) (+ 1 x)) Error: "reference to undefined identifier: _x"
arc> (macex '(def-with-prefix pre foo (x) (+ 1 x))) (eval (list (quote def) ; my indentation (read (+ (coerce pre (quote string)) "-" (coerce (quote foo) (quote string)))) (x) (+ 1 x)))
(mac def-with-prefix (prefix name args . body) `(eval (list 'def (read (+ (coerce ,prefix 'string) "-" (coerce ',name 'string))) ',args ,@(map [list 'quote _] body))))
Here's a slightly less clunky version:
(mac def-with-prefix (prefix name args . body) `(eval (join (list 'def (sym (+ (coerce ,prefix 'string) "-" (coerce ',name 'string))) ',args) ',body)))
-----