Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #++
- (defun foo()
- (with-guards((print "fle closed!!!")
- (print "pipe closed!!!")
- (print "socket closed!!!"))
- (print "using")))
- (defmacro with-guards((&rest guard*)&body body)
- (labels((rec(guard*)
- (if(endp guard*)
- (cons 'progn body)
- `(unwind-protect ,(rec(cdr guard*))
- ,(car guard*)))))
- (rec guard*)))
- #| in REPL.
- * (foo)
- "using"
- "socket closed!!!"
- "pipe closed!!!"
- "fle closed!!!"
- "using" ; <--- return value.
- |#
Add Comment
Please, Sign In to add comment