SHARE
TWEET

Untitled

a guest Mar 26th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top