Ludovic Courtès (2016-01-23 20:08 +0300) wrote:

> Alex Kost <[email protected]> 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?

-- 
Alex

Reply via email to