Advertisement
Guest User

Untitled

a guest
Aug 4th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.56 KB | None | 0 0
  1. (defmacro deft (name &body slots)
  2.   `(defstruct (,name (:conc-name)
  3.                      (:constructor
  4.                       ,name
  5.                       ,(loop
  6.                           for s in slots
  7.                           collect (typecase s
  8.                                     (symbol s)
  9.                                     (cons (first s))))))
  10.      ,@(loop
  11.           for s in slots
  12.           collect
  13.             (append (typecase s
  14.                       (symbol (list s nil))
  15.                       (cons s))
  16.                     (list :read-only t)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement