From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: Merging guix.el Date: Mon, 01 Sep 2014 12:26:26 +0400 Message-ID: <8761h7lpal.fsf@gmail.com> 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> 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]:57202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMwd-0000Xj-I2 for guix-devel@gnu.org; Mon, 01 Sep 2014 04:26:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOMwT-00087o-CE for guix-devel@gnu.org; Mon, 01 Sep 2014 04:26:35 -0400 In-Reply-To: <87lhq466xx.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 31 Aug 2014 16:59:38 +0200") 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix-devel Hello, I've just pushed a manual for =E2=80=9Cguix.el=E2=80=9D (into =E2=80=9Cemac= s-ui=E2=80=9D branch). I tried my best, but I'm not a native English speaker and I have never worked with Texinfo before, so there may be... issues :-) Ludovic Court=C3=A8s (2014-08-31 18:59 +0400) wrote: [...] >>> I would make %package-table a vhash instead of a hash table: >>> >>> (define %package-table >>> (vlist-fold (lambda (elem result) >>> (match elem >>> ((name . package) >>> (vhash-cons (cons (package-name package) >>> (package-version package)) >>> package >>> (if (vhash-assq name result) >>> ...))))) >>> vlist-null >>> %packages)) >> >> ... I left hash table, because I still don't understand how to use vhash >> for that: a name+version key should give a list of all matching >> packages, but AFAIU your variant would just replace one package with >> another (with the same name+version). > > The key is =E2=80=98vhash-fold*=E2=80=99 (info "(guile) VHashes"). It al= lows 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. Also I need to fold over unique names (I use =E2=80=98fold-manifest-entries= =E2=80=99 from =E2=80=9Cguix-main.scm=E2=80=9D for that) and I have no idea how vhash= can help there. (Sorry for being intrusive on that subject) >> As for =E2=80=98set-current-manifest-maybe!=E2=80=99, I'm afraid it can'= t be deleted. I >> found that I put it in some places where it shouldn't appear and I fixed >> that, but it still stays in functions returning =E2=80=9Cpackage informa= tion=E2=80=9D >> for the elisp side (for info/list buffers). Currently I can't invent a >> way how to get rid of this function completely. > > I think the profile=E2=80=99s file name could be kept on the elisp side, = and > passed to the Scheme code, which wouldn=E2=80=99t need to keep it in a gl= obal > variable. That would also allow guix.el to be used on profiles other > than the default one. Brilliant idea! Indeed it would be very useful to =E2=80=9Cfill=E2=80=9D c= ustom profiles. This will require some internal changes, but it shouldn't be too hard. I'll report when it will be done. > That said, we can look into it later if you prefer. WDYT? Yes, I think dealing with =E2=80=98set-current-manifest-maybe!=E2=80=99 is = not so important, it may wait for better times, thanks :)