Lisp noob macro question: I was working on a macro to enable a toy-ish version of classes, just to give some folks a feeling for what you can do with macros, and I found - as usual - that I don't what the hell I'm doing. When I try to define this macro: (mac defclass (name attributes methods)
`(def ,name (,@attributes)
(let methodz (obj ,@methods)
(fn (method . args)
((methodz method) args))))) Arc gives me this: Error: "map: expects type <proper list> as 2nd argument, given: (method . args); other arguments were: #<procedure:.../dev/arc2/ac.scm:209:14>" Note, however, that the concrete def on which this macro is based works just fine: (def make-point ((o x 0) (o y 0))
(let methods (obj
get-x [+ x]
get-y [+ y]
set-x [= x (car _)]
set-y [= y (car _)])
(fn (method . args)
((methods method) args)))) Thoughts? Advice? Any help would be greatly appreciated. Thanks everyone. |