[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/1] Factor out a common pattern into a procedure.
From: |
Mark H Weaver |
Subject: |
Re: [PATCH 1/1] Factor out a common pattern into a procedure. |
Date: |
Sun, 19 Oct 2014 10:57:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (gnu/linux) |
Ian Denhardt <address@hidden> writes:
> diff --git a/guix/utils.scm b/guix/utils.scm
> index 6392914..a179f6b 100644
> --- a/guix/utils.scm
> +++ b/guix/utils.scm
> @@ -2,6 +2,7 @@
> ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <address@hidden>
> ;;; Copyright © 2013 Mark H Weaver <address@hidden>
> ;;; Copyright © 2014 Eric Bavier <address@hidden>
> +;;; Copyright © 2014 Ian Denhardt <address@hidden>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -64,6 +65,7 @@
> %current-system
> %current-target-system
> version-compare
> + version-take-api
> version>?
> guile-version>?
> package-name->name+version
> @@ -518,6 +520,11 @@ or '= when they denote equal versions."
> ((negative? result) '<)
> (else '=))))))
>
> +(define (version-take-api version-string)
> + "Return \"<major>.<minor>\", where major and minor are the major and
> +minor version numbers from version-string."
> + (string-join (take (string-split version-string #\.) 2) "."))
> +
> (define (version>? a b)
> "Return #t when A denotes a newer version than B."
> (eq? '> (version-compare a b)))
Let's keep 'version-compare' and 'version>?' adjacent, in both the
export list and the implementation, since they are much more closely
related to each other than to this new procedure.
And as discussed in another message, let's rename the procedure and
replace the hard-coded 2 with an argument.
Thanks,
Mark
Re: [PATCH 1/1] Factor out a common pattern into a procedure.,
Mark H Weaver <=
Re: [PATCH 0/1] *** SUBJECT HERE ***, Ian Denhardt, 2014/10/18