## Version: Racket Version Checking

The "version" collection contains several version-related pieces that are used by Racket. See also version from racket/base.

### 1` `Installed Patch Level

(require version/patchlevel) | package: base |

### 2` `Checking Available Versions

(require version/check) | package: base |

procedure

(check-version) → (or/c symbol? list?)

`ok —

You’re fine. `(ok-but ,version) —

You have a fine stable version, but note that there is a newer alpha version available numbered version. `(newer ,version) —

You have an old version. Please upgrade to version. `(newer ,version ,alpha) —

You have an old-but-stable version, please upgrade to version; you may consider also the newer alpha version numbered alpha. `(error ,message) —

An error occurred, and message is a string that indicates the error. `(error ,message ,additional-info) —

An error occurred; message is a string that indicates the error, and additional-info is a string containing a system error. The additional-info content is always parenthesizes, so message is a short error and (string-append message " " additional-info) is a verbose one.

### 3` `Version Utilities

(require version/utils) | package: base |

procedure

(valid-version? v) → boolean?

v : any/c

A valid version has one of the following forms:

‹maj›.‹min›

‹maj›.‹min›.‹sub›

‹maj›.‹min›.‹sub›.‹rel›

subject to the following constraints:

‹maj›, ‹min›, ‹sub›, and ‹rel› are all canonical decimal representations of natural numbers (i.e., decimal digits with no leading 0 unless the number is exactly 0)

‹rel› is not 0

‹sub› is not 0 unless ‹rel› is included

‹min› has no more than two digits

‹sub› and ‹rel› have no more than three digits

The constraints force version numbers to be in a canonical form. For example, a would-be version string "4.3.0" must be written instead as "4.3", "4.3.1.0" must be written instead as "4.3.1", and "4" must be written as "4.0".

procedure

(version->list str)

→ (list/c integer? integer? integer? integer?) str : valid-version?

procedure

str1 : valid-version? str2 : valid-version?

procedure

(version<=? str1 str2) → boolean?

str1 : valid-version? str2 : valid-version?

procedure

(alpha-version? str) → boolean?

str : valid-version?

A version number of the form ‹maj›.‹min›, ‹maj›.‹min›.‹sub›, or ‹maj›.‹min›.‹sub›.‹rel› is an alpha version if ‹min› is 90 or more, ‹sub› is 900 or more, or ‹rel› is 900 or more.

procedure

(version->integer str) → (or/c integer? #f)

str : string?

Note that this is the only function that deals with legacy version strings.