From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH 1/6] emacs: Add 'guix-packages-by-location' command. Date: Mon, 18 Apr 2016 10:18:04 +0300 Message-ID: <87d1pnidw3.fsf@gmail.com> References: <1459799266-7426-1-git-send-email-alezost@gmail.com> <1459799266-7426-2-git-send-email-alezost@gmail.com> <87h9ffyeno.fsf@gnu.org> <874mbfxfdi.fsf@gmail.com> <878u0epl4k.fsf@gnu.org> <87bn58elrt.fsf@gmail.com> <87lh4c9rbu.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]:57893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1as3Rh-0006Qd-N5 for guix-devel@gnu.org; Mon, 18 Apr 2016 03:18:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1as3Rf-0004oS-0p for guix-devel@gnu.org; Mon, 18 Apr 2016 03:18:09 -0400 In-Reply-To: <87lh4c9rbu.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 17 Apr 2016 17:40:21 +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" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org Ludovic Court=C3=A8s (2016-04-17 18:40 +0300) wrote: > Alex Kost skribis: > >> Ludovic Court=C3=A8s (2016-04-16 01:23 +0300) wrote: > > [...] > >>> If you choose to take the =E2=80=98define-values=E2=80=99 approach abov= e, I think you >>> can just list they keys already in the vhash: >>> >>> (define-values (package-by-something-file package-something-files) >>> (let* ((table (delay =E2=80=A6)) >>> (files (delay >>> (delete-duplicates >>> (vhash-fold (lambda (file _ result) >>> (cons file result)) >>> '() >>> (force table)))))) >>> (values =E2=80=A6 >>> (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=C2=B2) and have similar readability, so both are fine with m= e! Thanks for clarifying, I have pushed this patchset. --=20 Alex