From 3730abd661d8d92a38fc88f62720eb0eb80cc1a9 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 30 Jan 2021 17:02:07 +0100 Subject: 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. --- l/src/main.lisp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'l/src/main.lisp') 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)))) -- cgit v1.2.3