diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-08-16 19:37:50 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-08-16 19:37:50 -0400 |
commit | 772f04dffd94970466e68642a896c5e4f59b55eb (patch) | |
tree | c3e28ede97327c7e74c5e1f97072ea5fb2fbdbce | |
parent | 362b9007077248edfe3d6b0ad38f6d07c7aaa10e (diff) |
Use unquote-splicing feature of guile-json 0.4.0.
* README.md ("Dependencies"): Specify guile-json >= 0.4.0.
* guix-web/view.scm (package->json): Use unquote-splicing to dedupe code.
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | guix-web/view.scm | 36 |
2 files changed, 16 insertions, 22 deletions
@@ -32,7 +32,7 @@ Dependencies * [GNU Guile](https://gnu.org/s/guile) >= 2.0.5 * [GNU Guix](https://gnu.org/s/guix) >= 0.6 -* [guile-json](https://github.com/aconchillo/guile-json) >= 0.3.1 +* [guile-json](https://github.com/aconchillo/guile-json) >= 0.4.0 Copyright --------- diff --git a/guix-web/view.scm b/guix-web/view.scm index 831fc7b..162e16b 100644 --- a/guix-web/view.scm +++ b/guix-web/view.scm @@ -106,27 +106,21 @@ (define (serialize-inputs packages) (map package->json (filter package? (map second packages)))) - (if serialize-inputs? - (json - (object - ("name" ,(package-name package)) - ("version" ,(package-version package)) - ("synopsis" ,(package-synopsis package)) - ("description" ,(package-description package)) - ("homepage" ,(package-home-page package)) - ("license" ,(serialize-license package)) - ("inputs" ,(serialize-inputs (package-inputs package))) - ("native-inputs" ,(serialize-inputs (package-native-inputs package))) - ("propagated-inputs" ,(serialize-inputs - (package-propagated-inputs package))))) - (json - (object - ("name" ,(package-name package)) - ("version" ,(package-version package)) - ("synopsis" ,(package-synopsis package)) - ("description" ,(package-description package)) - ("homepage" ,(package-home-page package)) - ("license" ,(serialize-license package)))))) + (json + (object + ("name" ,(package-name package)) + ("version" ,(package-version package)) + ("synopsis" ,(package-synopsis package)) + ("description" ,(package-description package)) + ("homepage" ,(package-home-page package)) + ("license" ,(serialize-license package)) + ,@(if serialize-inputs? + `(("inputs" ,(serialize-inputs (package-inputs package))) + ("native-inputs" ,(serialize-inputs + (package-native-inputs package))) + ("propagated-inputs" ,(serialize-inputs + (package-propagated-inputs package)))) + '())))) (define (all-packages-json) (map package->json (fold-packages cons '()))) |