(define-syntax (define-class name-and-members :rest body) "Macro for creating simple classes." (let ((name (first name-and-members)) (members (rest name-and-members))) `(define ;; The function definition (,(string->symbol (concat-strings "make-" (symbol->string name))) @members) ;; The docstring ,(concat-strings "This is the handle to an object of the class " (symbol->string name)) ;; the body (let ,(zip members members) @body (set-type (special-lambda (:rest args) "This is the docs for the handle" (eval (first args))) ,(symbol->keyword name)))))) (define-class (vec x y z))