diff options
author | Alex Kost <alezost@gmail.com> | 2016-03-31 21:29:27 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-04-04 20:11:22 +0300 |
commit | f1f09937a683eeeff48310c6ee713398b5a2c78b (patch) | |
tree | f52cbcd93290703d10f96d89df1a479f2ec3807b | |
parent | 5f2928456bf70a6869b0a415ca60b6cc1e43214c (diff) | |
download | patches-f1f09937a683eeeff48310c6ee713398b5a2c78b.tar patches-f1f09937a683eeeff48310c6ee713398b5a2c78b.tar.gz |
emacs: Stylistic improvements in guile code.
* emacs/guix-main.scm (package-unique?): Use 'match' instead of 'cdr'.
(package-by-address): Likewise.
-rw-r--r-- | emacs/guix-main.scm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index bcff9ce985..da42450d80 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -293,8 +293,10 @@ Example: (define (package-unique? package) "Return #t if PACKAGE is a single package with such name/version." - (null? (cdr (packages-by-name (package-name package) - (package-version package))))) + (match (packages-by-name (package-name package) + (package-version package)) + ((package) #t) + (_ #f))) (define %package-param-alist `((id . ,object-address) @@ -330,8 +332,9 @@ Example: ;;; Finding packages. (define (package-by-address address) - (and=> (vhash-assq address %packages) - cdr)) + (match (vhash-assq address %packages) + ((_ . package) package) + (_ #f))) (define (packages-by-name+version name version) (or (hash-ref %package-table |