Simplify list-repository-locations
Simplify `list-repository-location' by extracting the lambda's used and defining them as separate procedures.
This commit is contained in:
parent
ea945c83fa
commit
95125d682c
2 changed files with 11 additions and 7 deletions
|
@ -37,6 +37,7 @@
|
||||||
repo-location
|
repo-location
|
||||||
repo-name
|
repo-name
|
||||||
repository?
|
repository?
|
||||||
|
repository<?
|
||||||
same-repository?))
|
same-repository?))
|
||||||
|
|
||||||
(define show-unchanged-branches? #f)
|
(define show-unchanged-branches? #f)
|
||||||
|
@ -59,6 +60,10 @@
|
||||||
(define (repository? repo)
|
(define (repository? repo)
|
||||||
(is-a? repo <repository>))
|
(is-a? repo <repository>))
|
||||||
|
|
||||||
|
(define (repository<? repo1 repo2)
|
||||||
|
"Compary REPO1 and REPO2 to see if REPO1 should be considered smaller."
|
||||||
|
(string<? (repo-location repo1) (repo-location repo2)))
|
||||||
|
|
||||||
(define-method (branch-pullable (branch <branch>))
|
(define-method (branch-pullable (branch <branch>))
|
||||||
(force (slot-ref branch 'pullable)))
|
(force (slot-ref branch 'pullable)))
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,12 @@
|
||||||
|
|
||||||
(define (list-repository-locations)
|
(define (list-repository-locations)
|
||||||
"List the registered locations of repositories."
|
"List the registered locations of repositories."
|
||||||
(for-each
|
(for-each print-repository-location (sort repositories repository<?)))
|
||||||
(lambda (repo)
|
|
||||||
(display (repo-location repo))
|
(define (print-repository-location repo)
|
||||||
(newline))
|
"Print the location of REPO."
|
||||||
(sort repositories
|
(display (repo-location repo))
|
||||||
(lambda (s1 s2)
|
(newline))
|
||||||
(string<? (repo-location s1) (repo-location s2))))))
|
|
||||||
|
|
||||||
(define (registered? repo)
|
(define (registered? repo)
|
||||||
"Check if REPO has been registered."
|
"Check if REPO has been registered."
|
||||||
|
|
Loading…
Reference in a new issue