unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: Luciana Lima Brito <lubrito@posteo.net>
Cc: guix-devel@gnu.org
Subject: Re: Outreachy - Guix Data Service: questions about improving the data for derivation comparisons.
Date: Mon, 26 Apr 2021 22:21:50 +0100	[thread overview]
Message-ID: <87im48g2s1.fsf@cbaines.net> (raw)
In-Reply-To: <20210426161103.0647ee3f@lubrito>

[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]


Luciana Lima Brito <lubrito@posteo.net> writes:

> On Mon, 26 Apr 2021 09:15:37 +0100
> Christopher Baines <mail@cbaines.net> wrote:
>
>> 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.
>
> Ok, I changed that on the html.scm.

Great :)

Rather than writing:

  (match-lambda
    ((alist ...)

I'd just use

  (lambda (alist)

as I think that's equivalent right?

>> 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.
>
> I tried this for days but with no success. Maybe the only way would be
> to tweak group-to-alist, but it touches many places, and I didn't want
> to mess with it.

Maybe add another procedure that combines group-to-alist but generates
an alist with vectors as the values? (group-to-alist/vector maybe).

>>  - Could this be written in a form like:
>>
>>    ,@(map (lambda (name)
>>            ...)
>>           '(outputs inputs sources arguments))
>
> This only make sense to me inside render-json (because of the ,@), but I
> think the code would be less clean and "arguments" would appear in a
> different order. What I did was bind the result of a function similar
> to this in the let.

I think using let is OK, but I think just unpacking data-groups as
you've called it directly in to the alist is fine (so ,@data-groups),
rather than picking out the elements. JSON objects are unordered, so the
ordering isn't something that really matters.

If you do go down this route though, I'd probably add a comment saying
what things are being added to the outer most alist, just to make the
code quicker to read.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  reply	other threads:[~2021-04-26 21:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 18:29 Outreachy - Guix Data Service: questions about improving the data for derivation comparisons Luciana Lima Brito
2021-04-22  7:53 ` Christopher Baines
2021-04-22 20:00   ` Luciana Lima Brito
2021-04-22 20:08     ` Christopher Baines
2021-04-22 21:02       ` Luciana Lima Brito
2021-04-22 21:15         ` Christopher Baines
2021-04-23 21:15           ` Luciana Lima Brito
2021-04-23 21:48             ` Christopher Baines
2021-04-25 20:15               ` Luciana Lima Brito
2021-04-26  8:15                 ` Christopher Baines
2021-04-26 19:11                   ` Luciana Lima Brito
2021-04-26 21:21                     ` Christopher Baines [this message]
2021-04-27 13:10                       ` Luciana Lima Brito
2021-04-27 18:23                         ` Christopher Baines
2021-04-27 18:33                         ` Luciana Lima Brito
2021-04-27 18:42                           ` Christopher Baines
2021-04-27 19:53                             ` Luciana Lima Brito
2021-04-27 20:29                               ` Christopher Baines
2021-04-27 22:35                                 ` Luciana Lima Brito
2021-04-28  7:56                                   ` Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im48g2s1.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=guix-devel@gnu.org \
    --cc=lubrito@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).