From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id sAoLJ7x2hmDtcAAAgWs5BA (envelope-from ) for ; Mon, 26 Apr 2021 10:15:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GICbIbx2hmCXagAA1q6Kng (envelope-from ) for ; Mon, 26 Apr 2021 08:15:56 +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 45DD22402D for ; Mon, 26 Apr 2021 10:15:56 +0200 (CEST) Received: from localhost ([::1]:60644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lawPL-00082F-Df for larch@yhetil.org; Mon, 26 Apr 2021 04:15:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lawPA-000824-Cu for guix-devel@gnu.org; Mon, 26 Apr 2021 04:15:44 -0400 Received: from mira.cbaines.net ([212.71.252.8]:33492) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lawP8-0004zx-Ed for guix-devel@gnu.org; Mon, 26 Apr 2021 04:15:44 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id D58FC27BC7C; Mon, 26 Apr 2021 09:15:40 +0100 (BST) Received: from capella (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id ebbb2ff0; Mon, 26 Apr 2021 08:15:40 +0000 (UTC) References: <20210421152914.461bbdbb@lubrito> <87bla6iwli.fsf@cbaines.net> <20210422170040.37941083@lubrito> <875z0ehyl3.fsf@cbaines.net> <20210422180208.28473e41@lubrito> <87zgxqggw9.fsf@cbaines.net> <20210423181551.01c42455@lubrito> <87bla4hdto.fsf@cbaines.net> <20210425171507.6a259017@lubrito> User-agent: mu4e 1.4.15; emacs 27.1 From: Christopher Baines To: Luciana Lima Brito Subject: Re: Outreachy - Guix Data Service: questions about improving the data for derivation comparisons. In-reply-to: <20210425171507.6a259017@lubrito> Date: Mon, 26 Apr 2021 09:15:37 +0100 Message-ID: <87o8e1foly.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=212.71.252.8; 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=1619424956; 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=vto8ksMOYqLUel/L2lb01AkDAzfDuvcct9MtdzRW0fk=; b=JmrdmgqnZ/umYfc3QegX0SwGQKpsqXzUr4JVUVpNdFLM3knjwv7eydd/fs1WDm2b/aGQCp UeGZOo5K/5PiNkqK62kpgh4+0qm9H7n6WKVckCGbCxDZBF7pfzCUUHFGShalOT9zXedZ+/ 5R//rMPz+/V367mJRT6BuRa/eZFalvStMxhG3uIyDxbEMMLEfZuUXDGEiSodbRjweNzgbz fdbTxNC5quME3k1vV0sYLBX55l7CMUHQZtpw4TwYGtu7eY2SuNd3Te1+c7hpegu4rSHkQq huBI5+rz0+zNrHLijWjHlMgwHJZWuE+yRPsns6vh1MFLIDwLXgfQh11QT8RS6w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619424956; a=rsa-sha256; cv=none; b=JSlFIIfk+qjmgpb1pgrKzvuUh6eHgehZ1ocBhhPHn4/9Er2vv/UKAzAgRizIyRGwPNhZwm mPEIB6Mp0ZTD/nDtXXTqdEOmmPDbIXmygcXXZ3ptG4bRV3uCCIVke+BddZK4cJi636Iqrk m61qH3185wCGv1zeurRu/VDR3AfjruSDE+bm4cFJy3dDFt2EH72DTyFj+1LA4HXtwS+qtj tnESEUgPIh1WjMUhJJxYZZ3NpSR5QjbnoWL2xCUNuY8ZLAF0f3KfbtqZ1Ew6OhqH8sJ5mb I23OXGKMIXtStDCZ/ZzhVBh0lgI+P4fDg2TIDO/MxoRo5pvUimEut4xZT8mB0Q== 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: -4.55 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: 45DD22402D X-Spam-Score: -4.55 X-Migadu-Scanner: scn0.migadu.com X-TUID: Ym9GlYbIJBwZ --=-=-= Content-Type: text/plain Luciana Lima Brito writes: > Your advices helped me think more clearly. Great :) > There was no need to create or modify structures other than what I was > already changing. I now return an alist instead of a list on the > derivation-differences-* functions on comparison.scm (for outputs, > inputs and sources). It helped to simplify the mapping on > controller.scm. The changes on html.scm were minimal, basically it is > matching on pairs, instead of single values. > > Two questions: > > 1 - The match on the html expects 5 values for "outputs", so I had to > settle on using empty objects on the JSON, when needed, else it would > break the match on the html. Is it ok? So, one advantage of alists over lists is that the code is probably less brittle when adding elements say, since code parsing the list will probably break with a new element, but this is probably less likely to happen with an alist. However, this will happen with an alist if match is used to pick elements out. I'd suggest using assq-ref or similar to pluck elements out. > 2 - Now on controller.scm "outputs", "inputs", "sources", and even > "arguments" have the same structure, which is an alist of the form: > > ((base . (...)) > (target . (...)) > (common . (...))) > > and I'm using the same map and match-lambda code to process them, > wouldn't it be reasonable now to make it a local function? I'd consider these options first probably: - Could the data coming from derivation-differences-data have vectors where appropriate already? The HTML code would probably need to be adjusted, but I think that's fine. - Could this be written in a form like: ,@(map (lambda (name) ...) '(outputs inputs sources arguments)) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmCGdqpfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XeAsxAAkEhpXMaioo44DK8mivaQxgyJ8KLMF0D4 D+s2TcEiMq16U3XqcGT2G6RrF8EPOLOzxWxZij4WBDv6rxGRjTa+t/1GmtsY1Jzl 25WrqEMqzW0whqv6C62zMSucQTGirgpzBi0H/S+vJhVcDwkIL9MRzvjmtfP1Pg9/ I4yzFGFq4lSHwaeC1fgfiL20wRijrsvIy26f9J0mi+lAdyYRYZlCNMTUa6BqsEe2 31eAt+eIwOGsA9hea9WIthRSgdIVrOx3i/Pou3Q2hcaeNY1jRaWR5f7mRT7a/osv bbMHThjPXnk5tsvxzJwhJK1UZHi2J2XiXDflMQSlOXD0Xd00Bf6f87VTFnlnPZ8h VElQimqkPppIdL/3HpUhA35v/4Wa+TmzaQ7Yo1JW3+2TZfrcqy3AtxtfZpo1mCSK 56fbXXjx+Y5GjCuLs54LH34n0EV/UHkv0bUBOPnvsLqsLpsxs1gIVQn0QwqS5Lf9 a9MC2yIIwjpn75zQ4ABHEeL/uuKiGVinNjFnbw0M02XxDPRMiieJTBnc4gV0T0FW M18WzE+HIZUqUrWonErBoghEv6kv2QzRgceAxog96B64yK57GOMDjcNjufda/Xf/ VWBKTlUcnsh/qRiJfZgNZ+CEm8+7RKimDrqWgVkmZIZdzV0+yQkQGlwo8d+OqEas pUXN4ubV1aA= =GV+z -----END PGP SIGNATURE----- --=-=-=--