From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4AJOENKzeWB/+AAAgWs5BA (envelope-from ) for ; Fri, 16 Apr 2021 17:57:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iOsdCtKzeWBLTQAAB5/wlQ (envelope-from ) for ; Fri, 16 Apr 2021 15:57:06 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D6831252A4 for ; Fri, 16 Apr 2021 17:57:05 +0200 (CEST) Received: from localhost ([::1]:40284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXQq9-0001mr-0m for larch@yhetil.org; Fri, 16 Apr 2021 11:57:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXQgh-0001DJ-BQ for guix-devel@gnu.org; Fri, 16 Apr 2021 11:47:19 -0400 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:38557) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXQge-0007aB-E6 for guix-devel@gnu.org; Fri, 16 Apr 2021 11:47:19 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 7B6CC27BC6C; Fri, 16 Apr 2021 16:47:14 +0100 (BST) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id eb1e23ab; Fri, 16 Apr 2021 15:47:14 +0000 (UTC) References: <20210414164859.7acc631f@lubrito> <87wnt4x7e3.fsf@cbaines.net> <20210415130947.7387a546@lubrito> <87o8efxhil.fsf@cbaines.net> <20210416120740.05a819ca@lubrito> User-agent: mu4e 1.4.15; emacs 27.1 From: Christopher Baines To: Luciana Lima Brito Subject: Re: Outreachy - Guix Data Service: implementing basic json output for derivation comparison page In-reply-to: <20210416120740.05a819ca@lubrito> Date: Fri, 16 Apr 2021 16:47:10 +0100 Message-ID: <87czuuxmdd.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618588625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=fDqu5kV+a3f/uDDzdyvSIMyKwFl0feTgT+DkTwtNggk=; b=XpDrZOMyfPppGyx8kcKbeLJyNulKWkhc7vp7StxKa2ojYxdGmNPkC/01FaslA2srB4XM33 lRf+i9WzX1ZxtgofNtAPMH+VilJcBAdA4+Lky1vEANabF723OuHq/Ur0YyWVUKvA22HeMx wS9gHmgh3qOv35+RaLaoZnc4lTHXl+Hcoya1Ev7eyKJtBrnjgRB30KOhewzsVh+ih8FIO4 Qg56iSnggt+o2L/DPnSOaKSIj8Cl5+y4KhWLHXzm5vtc5w+N2MiPK1s9FhMagdFtskomQ8 1ZXZT9Wy7q7bn6BUcVDAv+MgxO+N6gqp8P0FNutSXjHQ+WI7tf3GW7nJDX/RaA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618588625; a=rsa-sha256; cv=none; b=E7FwGlR8zwKQKgboMaRUgaUJ+V3obTe9F+7GWgAnIbGkI4H2mCAun9KwCiOmnooFR3osQm /CCP/0YSsvhaYKA3Bemio4sK3zPLW/gUoUbGbZSKD8qXG47ysvCFbicDfaBBO2eEbTy9Tm IeKOdoq8YaqQAf1zRcarPKtFJajyvPhHHGWENIENM/6UyOK0dT2sM8SJV88JcuNvx2klf2 150G/DfGcC5ZzborY62TRSzk1tDJJi2Ye2Z7anX2fKxM3pEn7qeIH+vci4NRaNP5igRMqw wrrvudbsXUuRVG5EYylApZ2X6otaqS1joUrE+oscIJG1dQhuifnnIEmThKn+yg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -2.04 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: D6831252A4 X-Spam-Score: -2.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: TYQEjaFnlua5 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Luciana Lima Brito writes: > On Fri, 16 Apr 2021 00:19:46 +0100 > Christopher Baines wrote: > > Hi, > >> Ok, I looked at the overall diff, and it looks to me like these >> changes should probably be one commit. > > I don't actually understand what you mean saying it should be one > commit. Do I have to make my seven commits become a single one? How do > I do that? From=20looking at the content of your commits, I think they should be merged together. There's some information about that here for example: https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_squashing >> On the get-derivation-data function, I wouldn't use the same function >> to process the inputs, outputs and sources. The data for each is >> different, so I would separate the code as well. > > I understand that, but the logic to map the values for these three > bindings is the same, wouldn't it generate redundancies implementing > the same logic separately? I'm unsure three bindings are you referring to, can you clairfy? >> To avoid having to call a procedure three times, on the base, target >> and common items, I'd consider following the same pattern in the HTML >> generating code, map over a list of the lists, so something like: >> >> (map (lambda (name data) >> (cons name >> (match data >> ((name path hash-alg hash recursive) >> ...)))) >> '(base target common) >> (list (assq-ref outputs 'base) >> (assq-ref outputs 'target) >> (assq-ref outputs 'common))) >> >> Does that make sense? > > Actually I did it in a similar way before, but it resulted in a list > with all the values for base, target and common together, in which > I had to have another way to separate them and render on json, for > example, I tried appending "base", "target" or "common" names to each > list (similar to your function?), but them I had to convert this list to > a vector. Getting a list with all of the values in individually was possibly due to using append-map rather than map. > Calling the function for each separately gave me a cleaner > output. Also, I think that sometimes you might have more than one > output for base, target like it does for common, and I fail to see how > your example function addresses this. In short, I couldn't see the > benefit of this over calling the function three times. Is it for > organizational purpose or am I simply wrong? This time I'm just not > understanding. It's an organisational thing, code is generally more readable if the scope for variables is tight and there's less indirection. Defining a procedure is one form of indirection. It's often really helpful, but I think it's unnecessary here. You're right though about the above example not handling data being a list, I think that's a fixable problem though, rather than the (match data ...) bit, I'd suggest using map with match-lambda, probably wrapped with list->vector if you want a vector which will be outputted as a JSON array. Does that make sense? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmB5sX5fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XcbCw/9HeSb+0yRzFr0Hl90oV4wMYPiDIZeW9ww djiy90LvuUmPiQJZ8PuRpHz67XFb5caPuFmFH1KBcQvdoPx+4iKbhFLRlUGNgT9s lBn+SowM/LFxZoMpeYucuIwDKTa3WsnZLWpMylL2cFNFJ+aOFRcaKlAZWayChm66 PFY6YfFXmaM3ENhki0rBPDrd+r62sEnTbw6HFO8Z8oKN+5qEFkqMNmDTVv2rvjTO sqf7gN8St2CToJb6QC+Ul4ufU4LpwEkZT0dAKs+iMkvpQKNsUqVywsR3gkUf6LoU h65TGoDm53nzNz53AdU39i7RcPiGnDAz17cX0iIGlA9r5YmmFtDy2EVKEKThXbjx AG2ruogH4RxbcQE3p56uS5q0JKC8/RQC5QKFtyT/bA+ZCYn3bkC/woq7easH1hYD CxTP/54RKSHAy1CE3S2I4fBIfv1ir3/BL9Ci0d8NBMrrEs1RCLP+E8ShL144GWh0 GDEZu36JJ2V0c0Sm7fmb56H64/jqqnubnK/175er+vLUwTlGMRJp0wu2crXLO4nt 5AfcHTV5aaCfGZQP2G0RmeKtrwC5VkdCH55fzzjURzM/IYGJWH7TX+Layw5XigNA uQLbj577Tp9EA3XJnq2j5Tc1fFBLheYkJEa07O7EmpDc4PZw6ZgP3+zW8jzGC8qS XH3tr7p0ypw= =A92J -----END PGP SIGNATURE----- --=-=-=--