From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Merging guix.el Date: Mon, 01 Sep 2014 14:10:47 +0200 Message-ID: <87y4u38rso.fsf@gnu.org> References: <874mx3z9h2.fsf@gnu.org> <87fvgim60p.fsf@gmail.com> <87mwaobxbo.fsf@gnu.org> <87tx4wlbis.fsf@gmail.com> <87wq9s4bqy.fsf@gnu.org> <87iolbkvbc.fsf@gmail.com> <87lhq466xx.fsf@gnu.org> <8761h7lpal.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOQRr-0006RQ-Jx for guix-devel@gnu.org; Mon, 01 Sep 2014 08:11:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOQRd-00086P-MZ for guix-devel@gnu.org; Mon, 01 Sep 2014 08:11:03 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:53909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOQRd-00086H-FI for guix-devel@gnu.org; Mon, 01 Sep 2014 08:10:49 -0400 In-Reply-To: <8761h7lpal.fsf@gmail.com> (Alex Kost's message of "Mon, 01 Sep 2014 12:26:26 +0400") 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Kost Cc: Guix-devel Alex Kost skribis: > Ludovic Court=C3=A8s (2014-08-31 18:59 +0400) wrote: [...] >> The key is =E2=80=98vhash-fold*=E2=80=99 (info "(guile) VHashes"). It a= llows 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 =3D # >> scheme@(guile-user)> (vhash-fold* cons '() '("guile" "2.0") $12) >> $13 =3D (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 =E2=80=98vhash-fold*=E2=80=99 on =E2=80=98manifest-name->entry=E2= =80=99 vhash for each package > (to get installed outputs). With hash-table, I just need to use > =E2=80=98hash-ref=E2=80=99 for each package. =E2=80=98vhash-fold*=E2=80=99 iterates only on the values associated with t= he 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=E2=80=99ll = be exactly one package corresponding to a name/version pair.) > Also I need to fold over unique names (I use =E2=80=98fold-manifest-entri= es=E2=80=99 > from =E2=80=9Cguix-main.scm=E2=80=9D for that) and I have no idea how vha= sh can help > there. Would =E2=80=98vlist-fold=E2=80=99 work? --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (vhash-cons 'a 1 (vhash-cons 'b 2 (vhash-cons 'a 3 vli= st-null))) $2 =3D # scheme@(guile-user)> (vlist-fold cons '() $2) $3 =3D ((a . 3) (b . 2) (a . 1)) --8<---------------cut here---------------end--------------->8--- > Yes, I think dealing with =E2=80=98set-current-manifest-maybe!=E2=80=99 i= s not so > important, it may wait for better times, thanks :) Yes. :-) I=E2=80=99ll check the doc later today, but it seems this is essentially re= ady for merging, no? When we merge, would you like to rewrite history and make the whole thing appear as a single =E2=80=9Cperfect=E2=80=9D commit, or just merge = =E2=80=98emacs-ui=E2=80=99 into =E2=80=98master=E2=80=99? (I often do the former, but I=E2=80=99m fine wit= h the latter here.) Thanks, Ludo=E2=80=99.