Advertisement
Guest User

Untitled

a guest
Oct 30th, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. (defmacro data-ctor [name & args]
  2. `(defstruct ~name
  3. ~@(map (comp keyword str)
  4. (range (count args)))))
  5.  
  6. (defmacro type-ctor [name & ctors]
  7. `(do ~@(map (fn [ctor] (apply data-ctor ctor)) ctors)))
  8.  
  9. (type-ctor node
  10. (n2 :r :a :r)
  11. (n3 :r :a :r :a :r))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement