guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Merging guix.el


From: Alex Kost
Subject: Re: Merging guix.el
Date: Mon, 01 Sep 2014 12:26:26 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]