Subject: Re: Hack: dynamically discovering how to generate unquote and unquote-splicing.
From: (Rob Warnock)
Date: Sat, 15 Mar 2003 02:51:54 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Joerg Hoehle  <> wrote:
| Now, there's a repeating backquote pattern which goes like this:
| (defun foo (seq)
|   (with-foreign-object (buf `(c-array uint8 ,(length seq)) seq)
|     ...body...))
| I wish to optimize this case as well. This (c-array X ,Y) pattern is
| supposed to occur often in FFI interaction. I don't want to take
| advantage of the fact that it's CLISP's FFI and write unportable code
| for CLISP's backquote mechanism only.

That one looks simple. The 2nd arg of the macro is evaluated, right?
[Otherwise backquote wouldn't work in the first place.] So just
hand-expand it:

  (defun foo (seq)
    (with-foreign-object (buf (list 'c-array 'uint8 (length seq)) seq)

Now it's portable.


Rob Warnock, PP-ASEL-IA		<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607