From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ernuh-0003Xn-5I for guix-patches@gnu.org; Fri, 02 Mar 2018 11:52:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ernuc-0008Jw-9P for guix-patches@gnu.org; Fri, 02 Mar 2018 11:52:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ernuc-0008Jp-4T for guix-patches@gnu.org; Fri, 02 Mar 2018 11:52:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ernub-0005RQ-RX for guix-patches@gnu.org; Fri, 02 Mar 2018 11:52:01 -0500 Subject: [bug#30657] [PATCH 2/4] gexp: Add 'file-like?'. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180228222821.6195-1-clement@lassieur.org> <20180228222821.6195-2-clement@lassieur.org> Date: Fri, 02 Mar 2018 17:51:02 +0100 In-Reply-To: <20180228222821.6195-2-clement@lassieur.org> ("=?UTF-8?Q?Cl=C3=A9ment?= Lassieur"'s message of "Wed, 28 Feb 2018 23:28:19 +0100") Message-ID: <87sh9ictft.fsf@gnu.org> 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: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur Cc: 30657@debbugs.gnu.org Hello! Cl=C3=A9ment Lassieur skribis: > * guix/gexp.scm (file-like?): New exported procedure. > --- > guix/gexp.scm | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/guix/gexp.scm b/guix/gexp.scm > index f005c4d29..9a30579a6 100644 > --- a/guix/gexp.scm > +++ b/guix/gexp.scm > @@ -1,5 +1,6 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2014, 2015, 2016, 2017 Ludovic Court=C3=A8s > +;;; Copyright =C2=A9 2018 Cl=C3=A9ment Lassieur > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -70,6 +71,8 @@ > file-append-base > file-append-suffix >=20=20 > + file-like? > + > load-path-expression > gexp-modules >=20=20 > @@ -437,6 +440,14 @@ SUFFIX." > (base (expand base lowered output))) > (string-append base (string-concatenate suffix)))))= )) >=20=20 > +(define (file-like? object) > + (or (local-file? object) > + (plain-file? object) > + (computed-file? object) > + (program-file? object) > + (scheme-file? object) > + (file-append? object))) This procedure would miss new types added with =E2=80=98define-gexp-compile= r=E2=80=99. In fact I think you can simply write: (define file-like? (@@ (guix gexp) lookup-compiler)) Does that make sense? Ludo=E2=80=99.