Module ISN.ISSN

International Standard Serial Numbers (ISSNs)

type t = {
  1. sn : string;
    (*

    serial number

    *)
  2. cd : char;
    (*

    check digit

    *)
}

The type of parsed ISSNs.

val sn : t -> string

(sn t) is the serial number (exclusive of check digit) of the parsed ISSN t.

val cd : t -> char

(cd t) is the check digit of the parsed ISSN t.

val to_string : t -> string

to_string converts a parsed ISSN to a string representation.

val pretty : t -> string

pretty converts a parsed ISSN to a pretty string representation (includes hyphen).

val norm : string -> string
val parse : string -> t

(parse str) parses an ISSN.

The ISSN must have a check digit, but its validity is not checked; see valid.

See make to make a t from a serial number (an ISSN without a check digit).

The ISSN will first be normalized.

  • raises Invalid_argument

    if the normalized bn is not of length 8.

val compute : t -> char

(compute t) computes the check digit from a parsed ISSN.

Invariant: ∀t . (valid t) && (compute t = cd t).

val valid : t -> bool

(valid t) returns true if the parsed ISSN has a valid check digit and false otherwise.

val set : t -> t

(set t) computes and sets the check digit for the serial number in t.

(set t) works whether or not (valid t).

Invariant: ∀t . (valid t) && (t = (set t))

val make : string -> t

(make sn) makes a parsed ISSN from serial number sn.

A serial number has no check digit. See parse to parse an ISSN with a check digit.

The serial number will first be normalized.

  • raises Invalid_argument

    if the normalized sn is not of length 8.