Clean up documentation
This commit is contained in:
parent
55a1efa08f
commit
83d41ef778
16 changed files with 146 additions and 98 deletions
|
|
@ -1,9 +1,13 @@
|
|||
;; Procedures to deal with Go's semantic versions.
|
||||
(define-library (zilch lang go version)
|
||||
(import
|
||||
(scheme base) (srfi 152))
|
||||
|
||||
(export parse-version version<?)
|
||||
(begin
|
||||
|
||||
;; Returns a list containing five values parsed from the version string:
|
||||
;; `(major minor patch prerelease build)`
|
||||
(define (parse-version vstr)
|
||||
(unless (char=? (string-ref vstr 0) #\v) (error "not a valid version" vstr))
|
||||
(define first-period (string-index vstr (lambda (ch) (char=? ch #\.)) 1))
|
||||
|
|
@ -17,6 +21,7 @@
|
|||
(define build (and build-dash (string-copy vstr (+ build-dash 1))))
|
||||
(list major minor patch prerelease build))
|
||||
|
||||
;; Returns `#t` if `left` is a smaller version than `right`.
|
||||
(define (version<? left right)
|
||||
(set! left (parse-version left))
|
||||
(set! right (parse-version right))
|
||||
|
|
@ -43,4 +48,3 @@
|
|||
(and (list-ref left 3) (not (list-ref right 3)))
|
||||
; or both have a prerelease and it's comparable
|
||||
(and (list-ref left 3) (string<? (list-ref left 3) (list-ref right 3)))))))))))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue