Welcome to the CHICKEN Scheme pasting service

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))  <--

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What does `(string-chomp "foobar")' produce?
Visually impaired? Let me spell it for you (wav file) download WAV