aboutsummaryrefslogtreecommitdiffstats
path: root/src/macro.lisp
blob: 18c7d2124d3b1a0b89dc79b2cc4b8d7044d9c98d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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))))