From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:55215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4iR9-0008Ay-1B for guix-patches@gnu.org; Thu, 20 Feb 2020 04:48:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4iR7-00046W-WC for guix-patches@gnu.org; Thu, 20 Feb 2020 04:48:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j4iR7-00046Q-QV for guix-patches@gnu.org; Thu, 20 Feb 2020 04:48:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j4iR7-0005K0-Ok for guix-patches@gnu.org; Thu, 20 Feb 2020 04:48:01 -0500 Subject: [bug#39599] [PATCH 1/4] build-system: Add copy-build-system. Resent-Message-ID: References: <20200214125144.4185-1-mail@ambrevar.xyz> <20200217111228.23716-1-mail@ambrevar.xyz> From: Ricardo Wurmus In-reply-to: <20200217111228.23716-1-mail@ambrevar.xyz> Date: Thu, 20 Feb 2020 10:47:10 +0100 Message-ID: <87ftf5lhep.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Pierre Neidhardt Cc: 39599@debbugs.gnu.org Pierre Neidhardt writes: > + (define* (make-file-predicate matches matches-regexp #:optional (defau= lt-value #t)) > + (if (or matches matches-regexp) > + (lambda (file) > + (any (lambda (pred) (pred file)) > + (append > + (map (lambda (str) > + (lambda (f) (string-suffix? str f))) > + (or matches '())) > + (map (lambda (regexp) > + (lambda (f) (regexp-exec (make-regexp regexp) f))) > + (or matches-regexp '()))))) > + (const default-value))) This looks too complicated. I think this is clearer: --8<---------------cut here---------------start------------->8--- (define* (make-file-predicate suffixes matches-regexp #:optional (default-v= alue #t)) (if (or suffixes matches-regexp) (let* ((suffixes (or suffixes '())) (regexps (map make-regexp (or matches-regexp '()))) (predicates (append (map (lambda (str) (cut string-suffix? str <>)) suffixes) (map (lambda (regexp) (cut regexp-exec regexp <>)) regexps)))) (lambda (file) (any (cut <> file) predicates))) (const default-value))) --8<---------------cut here---------------end--------------->8--- Also, as Mathieu wrote, please don=E2=80=99t use SET!. --=20 Ricardo