guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 1/2] guix ui: add the "depends" field to package->recutils


From: Ludovic Courtès
Subject: Re: [PATCH v2 1/2] guix ui: add the "depends" field to package->recutils:
Date: Fri, 18 Jul 2014 01:26:13 +0200
User-agent: Gnus/5.130009 (Ma Gnus v0.9) Emacs/24.3 (gnu/linux)

Cyril Roelandt <address@hidden> skribis:

> * guix/packages.scm (package-direct-inputs): New procedure.
> * tests/packages.scm: Test it.
> * guix/ui.scm (package->recutils): Print the dependencies of the package.

[...]

> --- a/guix/ui.scm
> +++ b/guix/ui.scm
> @@ -456,6 +456,14 @@ WIDTH columns."
>    ;; Note: Don't i18n field names so that people can post-process it.
>    (format port "name: ~a~%" (package-name p))
>    (format port "version: ~a~%" (package-version p))
> +  (format port "depends: ~a~%"
> +          (string-join
> +            (map car
> +                 (sort (package-direct-inputs p)
> +                       (lambda (p1 p2)
> +                         (string<? (package-full-name (cadr p1))
> +                                   (package-full-name (cadr p2))))))
> +             ", "))

‘car’, ‘cadr’ & friends are frowned upon here.

Could you:

  1. make a local helper procedure:

     (define (package<? p1 p2)
       (string<? (package-full-name p1) ...))

  2. use ‘match’:

     (match (package-direct-inputs p)
       (((labels packages . _) ...)
        (string-join (sort packages package<?) ", ")))

Otherwise looks good.

Thanks!

Ludo’.



reply via email to

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