guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command.


From: Alex Kost
Subject: Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command.
Date: Mon, 18 Apr 2016 10:18:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Ludovic Courtès (2016-04-17 18:40 +0300) wrote:

> Alex Kost <address@hidden> skribis:
>
>> Ludovic Courtès (2016-04-16 01:23 +0300) wrote:
>
> [...]
>
>>> If you choose to take the ‘define-values’ approach above, I think you
>>> can just list they keys already in the vhash:
>>>
>>>   (define-values (package-by-something-file package-something-files)
>>>     (let* ((table (delay …))
>>>            (files (delay
>>>                     (delete-duplicates
>>>                       (vhash-fold (lambda (file _ result)
>>>                                     (cons file result))
>>>                                   '()
>>>                                   (force table))))))
>>>       (values …
>>>               (lambda () (force files)))))
>>
>> Great, thanks!  I'm going to use this variant.  Is there a preference
>> for 'delete-duplicates' over this?:
>>
>>   (vhash-fold (lambda (file _ result)
>>                 (if (member file result)
>>                     result
>>                   (cons file result)))
>>               '()
>>               (force table))
>
> Both are O(n²) and have similar readability, so both are fine with me!

Thanks for clarifying, I have pushed this patchset.

-- 
Alex



reply via email to

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