« first day (241 days earlier)   

1:55 PM
0
Q: How to get a text to be executed in LISP?

XavingSuppose that the following macro execution: (make-model '((1 2)(3 4)(5 6)(7 8))) , can generate the following list: ((MAKE-INSTANCE 'MODEL :NAME 7 :ID 8) (MAKE-INSTANCE 'MODEL :NAME 5 :ID 6) (MAKE-INSTANCE 'MODEL :NAME 3 :ID 4) (MAKE-INSTANCE 'MODEL :NAME 1 :ID 2)) If I store the resul...

 
 
3 hours later…
4:45 PM
0
Q: How to call a macro with a parameter instead of list in LISP?

XavingBased on the example provide in the practical common lisp reference, I define a macro to create a class as followed. (defmacro define-class (class-name class-slot) `(defclass ,class-name () ,(mapcar #'slot->defclass-slot class-slot)))) The function slot->declass-slot take a single argu...

 

« first day (241 days earlier)