Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

20 строки
709 B

  1. (define-syntax (define-class name-and-members :rest body)
  2. "Macro for creating simple classes."
  3. (let ((name (first name-and-members))
  4. (members (rest name-and-members)))
  5. `(define
  6. ;; The function definition
  7. (,(string->symbol (concat-strings "make-" (symbol->string name))) @members)
  8. ;; The docstring
  9. ,(concat-strings "This is the handle to an object of the class " (symbol->string name))
  10. ;; the body
  11. (let ,(zip members members)
  12. @body
  13. (set-type
  14. (special-lambda (:rest args)
  15. "This is the docs for the handle"
  16. (eval (first args)))
  17. ,(symbol->keyword name))))))
  18. (define-class (vec x y z))