[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command. |
Date: |
Sun, 17 Apr 2016 17:40:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
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!
Ludo’.
[PATCH 4/6] doc: emacs: Add "Locations" section., Alex Kost, 2016/04/04
[PATCH 5/6] emacs: Add interface for package locations., Alex Kost, 2016/04/04
[PATCH 6/6] emacs: Add license/location "Packages" buttons to Info buffer., Alex Kost, 2016/04/04