Advertisement
Guest User

Untitled

a guest
Jan 9th, 2019
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.07 KB | None | 0 0
  1. ;;; with-yeet.lisp
  2.  
  3. (defvar *yeets* '((de๐Ÿ…ฑun defun)
  4.                   (c๐Ÿ…ฑr cdr)
  5.                   (c๐Ÿ…ฐr car)
  6.                   (๐Ÿ˜ค lambda)
  7.                   (๐Ÿ™† let)
  8.                   (๐Ÿ’ labels)
  9.                   (๐Ÿ’ฉ nil)
  10.                   (๐Ÿ’ฉ? null)
  11.                   (๐Ÿ‘Œ t)
  12.                   (๐Ÿ“ฆ cons)
  13.                   (๐Ÿค“ cl-user)
  14.                   (๐Ÿ†‘ cl)))
  15.  
  16. (defun yeet-transform (program)
  17.   (if (consp program)
  18.       (cons (yeet-transform (car program))
  19.             (yeet-transform (cdr program)))
  20.       (let ((match (assoc program *yeets*)))
  21.         (if (null match)
  22.             program
  23.             (second match)))))
  24.  
  25. (defmacro with-yeet ((&key skkrt) &body body)
  26.   `(progn
  27.      ,(when skkrt
  28.         '(format t "~&yeetus that ๐Ÿ†‘~%"))
  29.      ,@(yeet-transform body)))
  30.  
  31. ;;; a sample program
  32.  
  33. (with-yeet (:skkrt t)
  34.   (de๐Ÿ…ฑun re๐Ÿ…ฑerse (๐Ÿ…ฑist)
  35.     (๐Ÿ’ ((๐Ÿ…ฐ (๐Ÿ…ฑ ๐Ÿ…ฐ)
  36.            (if (๐Ÿ’ฉ? ๐Ÿ…ฑ)
  37.                ๐Ÿ…ฐ
  38.                (๐Ÿ…ฐ (c๐Ÿ…ฑr ๐Ÿ…ฑ) (๐Ÿ“ฆ (c๐Ÿ…ฐr ๐Ÿ…ฑ) ๐Ÿ…ฐ)))))
  39.       (๐Ÿ…ฐ ๐Ÿ…ฑist ๐Ÿ’ฉ))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement