> Instead, you can directly build the list of matching packages, like: > (fold-packages (lambda (package result) > (if (or (regexp-exec rx (package-synopsis package)) > (regexp-exec rx (package-description package))) > (cons package result) > result)) > '()) > This way, only one traversal is done. 'regexp-exec' will raise an error if either 'synopsis' or 'description' is not a string. That's why I wrapped it in 'false-if-exception'. > For i18n, we should actually use (gettext (package-description > package)), likewise for synopsis. This way, that will search through > text in the user’s native language. I added it, but I haven't properly tested it. Also, there is 'remove-duplicates' that works in the REPL. But it doesn't remove duplicates when I call it via 'guix-package -s'. (Sometimes they appear and sometimes they don't show up.) Anyway, I'm attaching the patch. Nikita