no title added by buhman on Mon Dec 3 09:51:48 2018

(define-record-type foo
  (make-foo x y)
  foo?
  (x foo-x)
  (y foo-y))

(define-syntax test
  (ir-macro-transformer
   (lambda (exp inject compare)
     (let* ((type (cadr exp))
            (body (cddr exp))
            (get-x (inject (symbol-append (strip-syntax type) '- (strip-syntax 'x))))
            (get-y (inject (symbol-append (strip-syntax type) '- (strip-syntax 'y)))))
       `(let ((thing ,@body))
          (list (,get-x thing) (,get-y thing)))))))

#;446> (test 'foo (make-foo 1 2))

Error: (symbol-append) during expansion of (test ...) - bad argument type - not a symbol: (quote foo)

  Call history:

  <syntax>    (test (quote foo) (make-foo 1 2))
  <eval>    (cadr exp)
  <eval>    (cddr exp)
  <eval>    (inject (symbol-append (strip-syntax type) (quote -) (strip-syntax (quote x))))
  <eval>    (symbol-append (strip-syntax type) (quote -) (strip-syntax (quote x)))
  <eval>    (strip-syntax type)
  <eval>    (strip-syntax (quote x))  <--