[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/7] licenses: Add a list of licenses.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 2/7] licenses: Add a list of licenses. |
Date: |
Sun, 24 Jan 2016 21:59:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Kost <address@hidden> skribis:
> Ludovic Courtès (2016-01-23 20:08 +0300) wrote:
>
>> Alex Kost <address@hidden> skribis:
>>
>>> * guix/licenses.scm (%licenses): New variable.
>>
>> For the purposes of this patch set, I think we’d rather avoid that, and
>> instead do something like:
>>
>> (module-map (lambda (sym var)
>> (variable-ref var))
>> (resolve-interface '(guix licenses)))
>>
>> WDYT?
>
> Oh, great, I didn't know about 'module-map', thanks! But since there
> are also things like 'license?' or 'license-uri' in this module, we need
> to ignore objects which are not licenses. Would it be ok to do it like
> this:
>
> (hash-fold (lambda (sym var res)
> (let ((object (variable-ref var)))
> (if (license? object)
> (cons object res)
> res)))
> '()
> (module-obarray (resolve-interface '(guix licenses))))
>
> or is there a more idiomatic way?
Good point. I’d rather write it as:
(filter license? (module-map …))
(‘module-obarray’ is an implementation detail that may not be here
forever.)
Ludo’.