Advertisement
Guest User

Untitled

a guest
Jul 10th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. (defun gen-html-tag (form environment)
  2. (destructuring-bind (tag &rest body) form
  3. `(progn (format t "<~A>" ',tag)
  4. ,@body
  5. (format t "</~A>" ',tag))))
  6.  
  7. (setf (macro-function 'a) (function gen-html-tag)
  8. (macro-function 'p) (function gen-html-tag)
  9. #| …the whole html…|#)
  10.  
  11. (with-output-to-string (*standard-output*)
  12. (p (princ "foo")
  13. (a (princ "link"))
  14. (princ "bar")))
  15. #| --> "<p>foo<a>link</a>bar</p>" |#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement