fork download
  1. (defmacro steroid-let (&body body)
  2. (flet ((transform (form bodytail)
  3. (if (and (listp form)
  4. (eql :define (car form)))
  5. `((let (,(cdr form))
  6. ,@(or bodytail `(,(cadr form)))))
  7. (cons form bodytail))))
  8. `(progn
  9. ,@(reduce #'transform body :initial-value nil :from-end t))))
  10.  
  11. (progn
  12. #1=
  13. (steroid-let
  14. (:define x 2)
  15. (:define c 1)
  16. (setf c (+ c x))
  17. (:define y (1+ c))
  18. (format t "c: ~a, y: ~a~%" c y))
  19.  
  20. (print (macroexpand '#1#)))
Success #stdin #stdout 0.01s 29232KB
stdin
Standard input is empty
stdout
c: 3, y: 4

(PROGN
 (LET ((X 2))
   (LET ((C 1))
     (SETF C (+ C X))
     (LET ((Y (1+ C)))
       (FORMAT T "c: ~a, y: ~a~%" C Y)))))