From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: Adding wc to Bournish Date: Wed, 25 May 2016 12:43:09 +0300 Message-ID: <20160525094309.GA15009@debian-netbook> References: <20160524184720.GA27449@debian-netbook> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sdtB3X0nJg68CQEu" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5VLa-0006RG-0E for guix-devel@gnu.org; Wed, 25 May 2016 05:43:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5VLV-0007YC-R9 for guix-devel@gnu.org; Wed, 25 May 2016 05:43:24 -0400 Content-Disposition: inline In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel@gnu.org --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 25, 2016 at 11:03:34AM +0200, Ricardo Wurmus wrote: >=20 > Efraim Flashner writes: >=20 > > +(define (wc-command file) > > + (if (and (file-exists? file) (access? file 4)) > > + (let* ((wc-l ((@@ (guix build bournish) wc-l-command) file)) > > + (wc-w ((@@ (guix build bournish) wc-w-command) file)) > > + (wc-c ((@@ (guix build bournish) wc-c-command) file))) > > + (begin=20 > > + (display wc-l)(display #\space) > > + (display wc-w)(display #\space) > > + (display wc-c)(display #\space) > > + (display file) > > + (newline))))) >=20 > Have you considered using =E2=80=9Cformat=E2=80=9D instead of =E2=80=9Cdi= splay=E2=80=9D? The last > =E2=80=9Cbegin=E2=80=9D could just be this: >=20 > (format #t "~a ~a ~a ~a\n" > wc-l wc-w wc-c file) >=20 > or >=20 > (format #t "~{~a ~}\n" > (list wc-l wc-w wc-c file)) I looked at the manual more and I found for-each which does what I was looking for before which gave me this: (for-each display (list wc-l #\space wc-w #\space wc-c #\space file)) but I do like the (format #t "~{~a ~}\n" (list ...)) better. I'm working on trying to get it to read flags and the variable size of the list works better with that. format vs display, I knew I wanted display over write but I hadn't come across format yet. If I don't need to specify #\space to get a space then that sounds great. >=20 > Why is it necessary to do =E2=80=9C(@@ (guix build bournish) ...)=E2=80= =9D? Can it not > be imported once? When you say it out loud then it seems obvious it shouldn't need to be imported more than once. I've also read more about let vs let* and I've changed some to let. >=20 > ~~ Ricardo Thanks! --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --sdtB3X0nJg68CQEu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJXRXOqAAoJEPTB05F+rO6TEfQP/0e3EB8MbZ5+KTH0ZzH44V/Y w+/43E3SLVTKbQ7ViyUTlUz4u4wBXxzYwPUglf2XIAiSKGXUpjOzkUmQincHuMr/ OS4hXbZ6CBHCnYNacUbsgRzUFKCZoa0o1F5jgE3tpxt/p5ar0a+WssT8u96Ou1JM gbm2tuLVXrtUOC5te6GLPyMUnk6lb4lcjXcVavXmpZZZblSpqLH8fCzj/foGJuQc MI9AZC74pW4VZJw3xTIKH//9w+EU50j/DHskynQtYOsPC9qc3ChK1iRKNChSOr8i vVsFO1TbScuouV2Tztg17fyYDB0AJHAIZDFfXLg36HyhvILH4hnAtDzE5aAPzoBR /gmcimsowjV0SpUMFxDEQNRhTrSSg0sAWFlMIEB9JYhDKPGkGezJu/+Vgh5SBZ8m qlW43rz59Y7tZ9FxfRJBzhnlYCVZnqmlYLW/I9MnEjOHygnDWjZscy0iUVMlXYIM xdHponluh7CJxrVZwH3Naa2iTLN9AjSt1Ok/ff7c6K1dWF5tZC17S6b7v7s0awVW pwDGDQoPhGKDKTW/du/k5aeW+E5hz27kgV5jvE+kcAysMN2aknUP46yEVKSfi7JR DOor+9ZFAhPG2XmTQaASzrDtreLlqEBZ8oscJYgNgpdH1P6OulITvgHDcxejVcVU vovB5bEsnOLwGS0pnNgS =rTxQ -----END PGP SIGNATURE----- --sdtB3X0nJg68CQEu--