Add standard anaphoric macros aif and awhen
This commit is contained in:
parent
3c0b452d24
commit
f6f7a8a512
1 changed files with 17 additions and 1 deletions
|
|
@ -7,13 +7,29 @@
|
|||
(defpackage stoe.utils
|
||||
(:use :cl)
|
||||
(:nicknames :utils)
|
||||
(:export :restartable
|
||||
(:export :it
|
||||
:aif
|
||||
:awhen
|
||||
:restartable
|
||||
:eval-repl
|
||||
:update-current-time :get-delta-time
|
||||
:make-clock :clock-time :clock-delta
|
||||
:update-clock :compare-clocks))
|
||||
(in-package :stoe.utils)
|
||||
|
||||
(defmacro aif (test then else)
|
||||
"Bind the result of evaluating `test' to a variable named `it', as per Paul Graham's On Lisp."
|
||||
`(let ((it ,test))
|
||||
(if it
|
||||
,then
|
||||
,else)))
|
||||
|
||||
(defmacro awhen (test &body body)
|
||||
"Bind the result of evaluating `test' to a variable named `it', as per Paul Graham's On Lisp."
|
||||
`(let ((it ,test))
|
||||
(when it
|
||||
,@body)))
|
||||
|
||||
(defmacro restartable (unprotected &body body)
|
||||
"Provide a Continue restart unless unprotected is t."
|
||||
`(if ,unprotected
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue