#lang scheme/base
(require (prefix-in v: version/utils)
scheme/contract
(for-syntax scheme/base
(prefix-in v: version/utils))
mzlib/trace
)
(define (version? v)
(and (string? v)
(integer? (v:version->integer v))))
(define (vcomp? comp? v v2 vs)
(apply comp? (map v:version->integer (list* v v2 vs))))
(define (version<? v v2 . vs)
(vcomp? < v v2 vs))
(define (version<=? v v2 . vs)
(vcomp? <= v v2 vs))
(define (version>=? v v2 . vs)
(vcomp? >= v v2 vs))
(define (version>? v v2 . vs)
(vcomp? > v v2 vs))
(define (version=? v v2 . vs)
(vcomp? = v v2 vs))
(define (version!=? v v2 . vs)
(vcomp? (compose not =) v v2 vs))
(define vcomp/c (->* (version? version?)
()
#:rest (listof version?)
boolean?))
(provide/contract
(version? (-> any/c boolean?))
(version<? vcomp/c)
(version<=? vcomp/c)
(version>=? vcomp/c)
(version>? vcomp/c)
(version=? vcomp/c)
(version!=? vcomp/c)
)