aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2021-01-30 17:02:07 +0100
committerTeddy Wing2021-01-30 17:02:07 +0100
commit3730abd661d8d92a38fc88f62720eb0eb80cc1a9 (patch)
tree2291c6152d42ca5f3812b06b7684af0f9867bda3
parent8b0060a6b029eb5600abe0d8187c28d354dd7a33 (diff)
downloadextreload-3730abd661d8d92a38fc88f62720eb0eb80cc1a9.tar.bz2
main.lisp: Use `find-if` in `requested-extension-p`
I've been reading Practical Common Lisp's "Collections" chapter (http://www.gigamonkeys.com/book/collections.html) and it seemed like `find-if` would be nicer here than what I wrote before.
-rw-r--r--l/src/main.lisp11
1 files changed, 5 insertions, 6 deletions
diff --git a/l/src/main.lisp b/l/src/main.lisp
index a75fbc3..6abe363 100644
--- a/l/src/main.lisp
+++ b/l/src/main.lisp
@@ -66,13 +66,12 @@
(defun reload-extensions (targets extension-ids)
(labels ((requested-extension-p (target)
- (dolist (id extension-ids)
- (if (uiop:string-prefix-p
+ (find-if
+ #'(lambda (id)
+ (uiop:string-prefix-p
(concatenate 'string "chrome-extension://" id)
- (json-obj-get target "url"))
- (return-from requested-extension-p t)))
-
- nil))
+ (json-obj-get target "url")))
+ extension-ids)))
(dolist (extension (filter #'requested-extension-p targets))
(attach-to-target extension))))