From: Volkan YAZICI
Subject: Backquote Fuss
Date: 
Message-ID: <c58c6746-527e-4204-b640-a0c3323cd791@8g2000hse.googlegroups.com>
Hi,

In below macro

(defmacro define-formatter-generics-and-accessors (&body formatter-
specs)
  `(progn
     ,@(mapcar
        (lambda (formatter-spec)
          (destructuring-bind (formatter &rest args) formatter-spec
            (let ((generic-name
                   (intern (string-append "%" (symbol-name
formatter)))))
              `(progn
                 (defgeneric ,generic-name (rdbms ,@args))
                 (defmacro ,formatter ,args
                   `(,',generic-name
                     *rdbms*
                     ,@',(reduce
                          (lambda (accum key)
                            (let ((symbol-name (symbol-name key)))
                              (if (char-equal (elt symbol-name 0) #\&)
                                  accum
                                  (append
                                   (list (intern symbol-name :keyword)
                                         key)
                                   accum))))
                          args :initial-value nil)))))))
        formatter-specs)))

(define-formatter-generics-and-accessors
  (format-schema-identifier &key schema))

outputs

(PROGN
  (PROGN
    (DEFGENERIC %FORMAT-SCHEMA-IDENTIFIER (RDBMS &KEY SCHEMA))
    (DEFMACRO FORMAT-SCHEMA-IDENTIFIER (&KEY SCHEMA)
      '(%FORMAT-SCHEMA-IDENTIFIER *RDBMS* :SCHEMA SCHEMA))))

How should I modify (list (intern symbol-name :keyword) key) form to
make d-f-g-a-a to return

`(... :SCHEMA ,SCHEMA)

instead of

'(... :SCHEMA SCHEMA)

output?


Regards.

P.S. Pretty printed version of the code is located at
http://paste.lisp.org/display/66339

From: Pascal J. Bourguignon
Subject: Re: Backquote Fuss
Date: 
Message-ID: <7cbpz2lkss.fsf@pbourguignon.anevia.com>
Volkan YAZICI <·············@gmail.com> writes:
> In below macro
> (defmacro define-formatter-generics-and-accessors (&body formatter-
> [...]
> P.S. Pretty printed version of the code is located at
> http://paste.lisp.org/display/66339

Along with a solution...

-- 
__Pascal Bourguignon__
From: Volkan YAZICI
Subject: Re: Backquote Fuss
Date: 
Message-ID: <46747f0d-4ff5-4103-a352-d3e3d567a235@a70g2000hsh.googlegroups.com>
On Sep 5, 5:38 pm, ····@informatimago.com (Pascal J. Bourguignon)
wrote:
> Along with a solution...

I'd be happy to hear the backquote solution along with a keyword hack.


Regards.
From: Alex Mizrahi
Subject: Re: Backquote Fuss
Date: 
Message-ID: <48c1554e$0$90276$14726298@news.sunsite.dk>
 VY>                      ,@',(reduce

here, replace ,@', with ,@,

and it produces:

(PROGN
 (PROGN
  (DEFGENERIC %FORMAT-SCHEMA-IDENTIFIER (RDBMS &KEY SCHEMA))
  (DEFMACRO FORMAT-SCHEMA-IDENTIFIER (&KEY SCHEMA)
    `(%FORMAT-SCHEMA-IDENTIFIER *RDBMS* ,@(:SCHEMA SCHEMA)))))

i guess that's what you want?

...

in more general way, you should have moved quote from ,@', to your
(list (intern symbol-name :keyword) key) expression, sort of
`(',(intern symbol-name :keyword) ,key)
but it's not needed here because (quote :kerword) is same as :kerword

but i agree with Pascal -- second backquote here just mades code more 
cryptic..