Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. (defun thunk-component-args (prefab-spec)
  2. (flet ((split-body (body)
  3. (au:partition #'symbolp body :key #'first))
  4. (thunk-args (args)
  5. (loop :for (key val) :on args :by #'cddr
  6. :collect key :collect (lambda () val))))
  7. (multiple-value-bind (components children) (split-body (rest prefab-spec))
  8. `(,(first prefab-spec)
  9. ,@(loop :for (name options . args) :in components
  10. :collect `(,name ,options ,@(thunk-args args)))
  11. ,@(mapcar #'thunk-component-args children)))))
  12.  
  13. ;;
  14.  
  15. (mapcar #'thunk-component-args '(("foo" (foo () :arg (list 42)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement