Bit of background, I'm a total lisp noob, only started a few weeks ago, but I've been developing in other langs for years. Logic no problem, lisp, problem.
I'm trying to write a macro that will define two clsql classes for me to get around a problem with the library. I'd like the classes to be named x
and `x-insert`` , so within the macro I'd like the macro to compute the symbol name of x-insert, but I'm having difficulity doing this. My attempt is below, but i'm stumped on two things.
How do I get it to create the class names. If i remove the space in ,class -insert
, it wont eval, which I understand, so I presume I'm missing some straightforward way to tell it to ignore the space,and create the name as a single word, and the second problem is getting it to create two classes, not one, as its only expanding the last part of the macro from what I can see using macro expand.
Perhaps I'm going about this the wrong way altogether, so feel free to kick me in the right direction.
(defmacro gen-pair (class base-slots pkey-slot base-table)
`(clsql:def-view-class ,class -insert()
(
,base-slots
)
(:base-table ,base-table)
)
`(clsql:def-view-class ,class (,class -insert)
(
,pkey-slot
)
(:base-table ,base-table)
)
)