aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-01-31 16:27:13 +0100
committerTeddy Wing2021-01-31 16:27:13 +0100
commit5055107b69e72457c37ed0ece91004665e4ad2e3 (patch)
tree68a71c5d6bc4b99b29c74da63a34259e006f7c70
parentb731acb089d93ef7b55f6ed80c2762ce1de3aa3f (diff)
downloadextreload-5055107b69e72457c37ed0ece91004665e4ad2e3.tar.bz2
Convert `filter` from a function to a macro
Doesn't make a big difference, just for fun. I like the idea of a compile-time version of this since it's essentially just renaming `remove-if-not`. Move it to a new file so we can include it before it's used in `main.lisp`.
-rw-r--r--l/extreload.asd1
-rw-r--r--l/src/macro.lisp4
-rw-r--r--l/src/main.lisp3
3 files changed, 5 insertions, 3 deletions
diff --git a/l/extreload.asd b/l/extreload.asd
index 5edcdd7..21a5329 100644
--- a/l/extreload.asd
+++ b/l/extreload.asd
@@ -5,6 +5,7 @@
:components ((:module "src"
:serial t
:components ((:file "package")
+ (:file "macro")
(:file "main"))))
:build-operation "program-op"
diff --git a/l/src/macro.lisp b/l/src/macro.lisp
new file mode 100644
index 0000000..4d69294
--- /dev/null
+++ b/l/src/macro.lisp
@@ -0,0 +1,4 @@
+(in-package :extreload)
+
+(defmacro filter (predicate list-form)
+ `(remove-if-not ,predicate ,list-form))
diff --git a/l/src/main.lisp b/l/src/main.lisp
index 6abe363..42c0ccd 100644
--- a/l/src/main.lisp
+++ b/l/src/main.lisp
@@ -91,6 +91,3 @@
"background_page")))
(filter #'extensionp targets)))
-
-(defun filter (predicate list-form)
- (remove-if-not predicate list-form))