aboutsummaryrefslogtreecommitdiffstats
path: root/src/macro.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/macro.lisp')
-rw-r--r--src/macro.lisp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/macro.lisp b/src/macro.lisp
new file mode 100644
index 0000000..18c7d21
--- /dev/null
+++ b/src/macro.lisp
@@ -0,0 +1,14 @@
+(in-package :extreload)
+
+(defmacro filter (predicate list-form)
+ "Returns a sequence that only includes elements of `list-form` that satisfy
+the test of `predicate`."
+ `(remove-if-not ,predicate ,list-form))
+
+(defmacro with-websocket-connection ((client) &body body)
+ "Open a WebSocket connection on `client` and run `body` forms. The connection
+is automatically closed at the end of execution."
+ `(progn
+ (wsd:start-connection ,client)
+ (unwind-protect (progn ,@body)
+ (wsd:close-connection ,client))))