From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIwDU-00031O-0N for guix-patches@gnu.org; Thu, 08 Jun 2017 08:07:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIwDO-0006CR-TN for guix-patches@gnu.org; Thu, 08 Jun 2017 08:07:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:59741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIwDO-0006CK-QH for guix-patches@gnu.org; Thu, 08 Jun 2017 08:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dIwDO-0004Ls-HA for guix-patches@gnu.org; Thu, 08 Jun 2017 08:07:02 -0400 Subject: bug#27275: [PATCH 1/2] pull: Add a dependency to guile-git. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170607120405.7156-1-m.othacehe@gmail.com> <20170607120553.7382-1-m.othacehe@gmail.com> <87r2yw56q4.fsf@gnu.org> <8660g7kifz.fsf@gmail.com> Date: Thu, 08 Jun 2017 14:06:09 +0200 In-Reply-To: <8660g7kifz.fsf@gmail.com> (Mathieu Othacehe's message of "Wed, 07 Jun 2017 15:58:56 +0200") Message-ID: <87bmpyznta.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: Mathieu Othacehe Cc: 27275@debbugs.gnu.org Hello! Mathieu Othacehe skribis: >>> (set! %load-compiled-path >>> (cons* json >>> + (string-append #$guile-git "/lib/guile/" >>> + #$(effective-version)- >>> + "/site-ccache") >> >> =E2=80=98guile-git=E2=80=99 can be #f so you have to account for that. > > Just on question about that. The easier I come up with is something like > : >=20=20 > > (set! %load-path > (append > `(,@(if > (and #$guile-git #$guile-bytestructures) > (list > (string-append #$guile-git "/share/guile/site/" > #$(effective-version)) > (string-append #$guile-bytestructures "/share/guile/site/" > #$(effective-version))) > '())) > (cons* json > (string-append #$guile-ssh "/share/guile/site/" > #$(effective-version)) > %load-path))) > > Any idea on how to write that smoothly ? Maybe with a macro along these lines: --8<---------------cut here---------------start------------->8--- (letrec-syntax ((maybe-load-path (syntax-rules () ((_ item rest ...) (let ((tail (maybe-load-path rest ...))) (if (string? item) (cons (string-append item "/share/guile/site/" (effective-version)) tail) tail))) ((_) '())))) (set! %load-path (maybe-load-path json guile-git guile-bytestructures))) --8<---------------cut here---------------end--------------->8--- HTH, Ludo=E2=80=99.