unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Merging guix.el
Date: Mon, 01 Sep 2014 12:26:26 +0400	[thread overview]
Message-ID: <8761h7lpal.fsf@gmail.com> (raw)
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")

Hello,

I've just pushed a manual for “guix.el” (into “emacs-ui” 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ès (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 ‘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.

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.

(Sorry for being intrusive on that subject)

>> As for ‘set-current-manifest-maybe!’, 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 “package information”
>> 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’s file name could be kept on the elisp side, and
> passed to the Scheme code, which wouldn’t need to keep it in a global
> 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 “fill” custom
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 ‘set-current-manifest-maybe!’ is not so
important, it may wait for better times, thanks :)

  reply	other threads:[~2014-09-01  8:26 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 [this message]
2014-09-01 12:10               ` Ludovic Courtès
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

  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=8761h7lpal.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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 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).