Numerical types

Mathematically, numbers are arranged into a tower of subtypes in which each level is a subset of the level above it:

  • number
  • complex number
  • real number
  • rational number
  • integer

For example, 3 is an integer. Therefore 3 is also a rational, a real, and a complex number. The same is true of the Scheme numbers that model 3. For Scheme numbers, these types are defined by the predicates number?, complex?, the same integer.

Scheme's numerical operations treat numbers as abstract data, as independent of their representation as possible. Although Husk may use multiple internal representations of numbers, this ought not to be apparent to a casual programmer writing simple programs.

husk-scheme online documentation rev 3.2 (2021.03.04)