all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Merging guix.el
Date: Mon, 01 Sep 2014 14:10:47 +0200	[thread overview]
Message-ID: <87y4u38rso.fsf@gnu.org> (raw)
In-Reply-To: <8761h7lpal.fsf@gmail.com> (Alex Kost's message of "Mon, 01 Sep 2014 12:26:26 +0400")

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2014-08-31 18:59 +0400) wrote:

[...]

>> The key is ‘vhash-fold*’ (info "(guile) VHashes").  It allows you to
>> traverse all the entries associated with a given key:
>>
>> scheme@(guile-user)> (vhash-cons '("guile" "2.0") 'foo
>> 				 (vhash-cons '("guile" "2.0") 'bar
>> 					     vlist-null))
>> $12 = #<vhash 39240a0 2 pairs>
>> scheme@(guile-user)> (vhash-fold* cons '() '("guile" "2.0") $12)
>> $13 = (bar foo)
>>
>> I think that answers your question, right?
>
> Absolutely; sorry for missing that feature.  But will it be a real
> optimization?  If I want to get information for all packages, I have to
> perform ‘vhash-fold*’ on ‘manifest-name->entry’ vhash for each package
> (to get installed outputs).  With hash-table, I just need to use
> ‘hash-ref’ for each package.

‘vhash-fold*’ iterates only on the values associated with the given key;
it has time complexity linear in the number of values associated with
that key.  So no worries here (and again, 90% of the time there’ll be
exactly one package corresponding to a name/version pair.)

> Also I need to fold over unique names (I use ‘fold-manifest-entries’
> from “guix-main.scm” for that) and I have no idea how vhash can help
> there.

Would ‘vlist-fold’ work?

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (vhash-cons 'a 1 (vhash-cons 'b 2 (vhash-cons 'a 3 vlist-null)))
$2 = #<vhash 26fd3a0 3 pairs>
scheme@(guile-user)> (vlist-fold cons '() $2)
$3 = ((a . 3) (b . 2) (a . 1))
--8<---------------cut here---------------end--------------->8---

> Yes, I think dealing with ‘set-current-manifest-maybe!’ is not so
> important, it may wait for better times, thanks :)

Yes.  :-)

I’ll check the doc later today, but it seems this is essentially ready
for merging, no?

When we merge, would you like to rewrite history and make the whole
thing appear as a single “perfect” commit, or just merge ‘emacs-ui’ into
‘master’?  (I often do the former, but I’m fine with the latter here.)

Thanks,
Ludo’.

  reply	other threads:[~2014-09-01 12:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23 12:17 Merging guix.el Ludovic Courtès
2014-08-24  6:59 ` Alex Kost
2014-08-25  8:23   ` Ludovic Courtès
2014-08-25 12:31     ` Alex Kost
2014-08-25 22:03       ` Ludovic Courtès
2014-08-26  4:14         ` Alex Kost
2014-08-27 13:11 ` Alex Kost
2014-08-28 12:41   ` Ludovic Courtès
2014-08-28 18:22     ` Alex Kost
2014-08-28 20:09       ` Ludovic Courtès
2014-08-29 18:24         ` Alex Kost
2014-08-31 14:59           ` Ludovic Courtès
2014-09-01  8:26             ` Alex Kost
2014-09-01 12:10               ` Ludovic Courtès [this message]
2014-09-02 20:22                 ` Alex Kost
2014-09-03  7:09                   ` Ludovic Courtès
2014-09-03 20:53                     ` Alex Kost
2014-09-01 22:28               ` Ludovic Courtès
2014-09-02 20:22                 ` Alex Kost
2014-09-02 21:13                   ` Ludovic Courtès
2014-09-02 20:22             ` Alex Kost
2014-09-02 21:09               ` Ludovic Courtès

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

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

  git send-email \
    --in-reply-to=87y4u38rso.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.