aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/math
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation/lux/math')
-rw-r--r--stdlib/source/documentation/lux/math/infix.lux2
-rw-r--r--stdlib/source/documentation/lux/math/logic.lux14
-rw-r--r--stdlib/source/documentation/lux/math/modular.lux53
-rw-r--r--stdlib/source/documentation/lux/math/modulus.lux39
-rw-r--r--stdlib/source/documentation/lux/math/number.lux52
-rw-r--r--stdlib/source/documentation/lux/math/number/complex.lux64
-rw-r--r--stdlib/source/documentation/lux/math/number/frac.lux127
-rw-r--r--stdlib/source/documentation/lux/math/number/i16.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/i32.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/i64.lux123
-rw-r--r--stdlib/source/documentation/lux/math/number/i8.lux25
-rw-r--r--stdlib/source/documentation/lux/math/number/int.lux127
-rw-r--r--stdlib/source/documentation/lux/math/number/nat.lux82
-rw-r--r--stdlib/source/documentation/lux/math/number/ratio.lux45
-rw-r--r--stdlib/source/documentation/lux/math/number/rev.lux115
-rw-r--r--stdlib/source/documentation/lux/math/random.lux139
16 files changed, 1047 insertions, 10 deletions
diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux
index ccb72f665..add6876f2 100644
--- a/stdlib/source/documentation/lux/math/infix.lux
+++ b/stdlib/source/documentation/lux/math/infix.lux
@@ -27,5 +27,5 @@
(.List $.Module)
($.module /._
""
- []
+ [..infix]
[]))
diff --git a/stdlib/source/documentation/lux/math/logic.lux b/stdlib/source/documentation/lux/math/logic.lux
index 1b455c23e..f5aaddfc3 100644
--- a/stdlib/source/documentation/lux/math/logic.lux
+++ b/stdlib/source/documentation/lux/math/logic.lux
@@ -6,17 +6,13 @@
[text
["%" format (#+ format)]]
[collection
- ["." list]]]]]
+ ["." list ("#\." monoid)]]]]]
["." / #_
["#." continuous]
- ["#." fuzzy]]
- [\\library
- ["." /]])
+ ["#." fuzzy]])
(.def: .public documentation
(.List $.Module)
- ($.module /._
- ""
- []
- [/continuous.documentation
- /fuzzy.documentation]))
+ ($_ list\compose
+ /continuous.documentation
+ /fuzzy.documentation))
diff --git a/stdlib/source/documentation/lux/math/modular.lux b/stdlib/source/documentation/lux/math/modular.lux
new file mode 100644
index 000000000..f0c4c9f33
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/modular.lux
@@ -0,0 +1,53 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Mod
+ "A number under a modulus.")
+
+(documentation: /.modular
+ ""
+ [(modular modulus value)])
+
+(documentation: /.adapter
+ ""
+ [(adapter reference subject)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Mod
+ ..modular
+ ..adapter
+ ($.default /.modulus)
+ ($.default /.value)
+ ($.default /.incorrect_modulus)
+ ($.default /.codec)
+
+ ($.default /.=)
+ ($.default /.<)
+ ($.default /.<=)
+ ($.default /.>)
+ ($.default /.>=)
+
+ ($.default /.equivalence)
+ ($.default /.order)
+
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.*)
+
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.inverse)
+ ($.default /.moduli_are_not_equal)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/modulus.lux b/stdlib/source/documentation/lux/math/modulus.lux
new file mode 100644
index 000000000..c97eaa270
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/modulus.lux
@@ -0,0 +1,39 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Modulus
+ (format "A number used as a modulus in modular arithmetic."
+ \n "It cannot be 0."))
+
+(documentation: /.congruent?
+ ""
+ [(congruent? modulus reference subject)])
+
+(documentation: /.literal
+ ""
+ ["Success!"
+ (literal 123)]
+ ["Failure!"
+ (literal 0)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Modulus
+ ..congruent?
+ ..literal
+ ($.default /.zero_cannot_be_a_modulus)
+ ($.default /.modulus)
+ ($.default /.divisor)
+ ($.default /.=)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux
new file mode 100644
index 000000000..d4243f21d
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number.lux
@@ -0,0 +1,52 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." i8]
+ ["#." i16]
+ ["#." i32]
+ ["#." i64]
+ ["#." nat]
+ ["#." int]
+ ["#." rev]
+ ["#." frac]
+ ["#." ratio]
+ ["#." complex]])
+
+(template [<name> <encoding> <no_commas> <with_commas>]
+ [(documentation: <name>
+ (format "Given syntax for a " <encoding> " number, generates a Nat, an Int, a Rev or a Frac.")
+ [<no_commas>]
+ ["Allows for the presence of commas (,) among the digits."
+ <with_commas>])]
+
+ [/.bin "binary" (bin "11001001") (bin "11,00,10,01")]
+ [/.oct "octal" (oct "615243") (oct "615,243")]
+ [/.hex "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF")]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..bin
+ ..oct
+ ..hex]
+ [/i8.documentation
+ /i16.documentation
+ /i32.documentation
+ /i64.documentation
+ /nat.documentation
+ /int.documentation
+ /rev.documentation
+ /frac.documentation
+ /ratio.documentation
+ /complex.documentation]))
diff --git a/stdlib/source/documentation/lux/math/number/complex.lux b/stdlib/source/documentation/lux/math/number/complex.lux
new file mode 100644
index 000000000..0a56b0d85
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/complex.lux
@@ -0,0 +1,64 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Complex
+ "A complex number.")
+
+(documentation: /.complex
+ "Complex literals."
+ [(complex real imaginary)]
+ ["The imaginary part can be omitted if it's +0.0."
+ (complex real)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Complex arithmetic."
+ [..Complex
+ ..complex
+ ($.default /.i)
+ ($.default /.+one)
+ ($.default /.-one)
+ ($.default /.zero)
+ ($.default /.not_a_number?)
+ ($.default /.=)
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.equivalence)
+ ($.default /.opposite)
+ ($.default /.signum)
+ ($.default /.conjugate)
+ ($.default /.*')
+ ($.default /.*)
+ ($.default /./)
+ ($.default /./')
+ ($.default /.%)
+ ($.default /.cos)
+ ($.default /.cosh)
+ ($.default /.sin)
+ ($.default /.sinh)
+ ($.default /.tan)
+ ($.default /.tanh)
+ ($.default /.abs)
+ ($.default /.exp)
+ ($.default /.log)
+ ($.default /.pow)
+ ($.default /.pow')
+ ($.default /.root/2)
+ ($.default /.reciprocal)
+ ($.default /.acos)
+ ($.default /.asin)
+ ($.default /.atan)
+ ($.default /.argument)
+ ($.default /.roots)
+ ($.default /.approximately?)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux
new file mode 100644
index 000000000..a161327fa
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/frac.lux
@@ -0,0 +1,127 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Frac(tion) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Frac(tion) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Frac(tion) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Frac(tion) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Frac(tion) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Frac(tion) addition."]
+ [/.- "Frac(tion) substraction."]
+ [/.* "Frac(tion) multiplication."]
+ [/./ "Frac(tion) division."]
+ [/.% "Frac(tion) remainder."]
+ )
+
+(documentation: /./%
+ ""
+ [(/% param subject)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Frac(tion) minimum."]
+ [/.max "Frac(tion) minimum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>)]
+
+ [/.not_a_number "Not a number."]
+ [/.positive_infinity "Positive infinity."]
+ [/.negative_infinity "Negative infinity."]
+ )
+
+(documentation: /.not_a_number?
+ "Tests whether a frac is actually not-a-number."
+ [(not_a_number? it)])
+
+(documentation: /.approximately?
+ ""
+ [(approximately? margin_of_error standard value)])
+
+(documentation: /.mod
+ ""
+ [(mod divisor dividend)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ../%
+ ..min
+ ..max
+ ..not_a_number
+ ..positive_infinity
+ ..negative_infinity
+ ..not_a_number?
+ ..approximately?
+ ..mod
+ ($.default /.positive?)
+ ($.default /.negative?)
+ ($.default /.zero?)
+ ($.default /.opposite)
+ ($.default /.abs)
+ ($.default /.signum)
+ ($.default /.nat)
+ ($.default /.int)
+ ($.default /.rev)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.smallest)
+ ($.default /.biggest)
+ ($.default /.addition)
+ ($.default /.addition)
+ ($.default /.minimum)
+ ($.default /.maximum)
+ ($.default /.number?)
+ ($.default /.decimal)
+ ($.default /.bits)
+ ($.default /.of_bits)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i16.lux b/stdlib/source/documentation/lux/math/number/i16.lux
new file mode 100644
index 000000000..a38b3cbff
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i16.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I16
+ "A 16-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I16
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i16)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i32.lux b/stdlib/source/documentation/lux/math/number/i32.lux
new file mode 100644
index 000000000..5f438cc50
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i32.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I32
+ "A 32-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I32
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i32)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i64.lux b/stdlib/source/documentation/lux/math/number/i64.lux
new file mode 100644
index 000000000..9a7d3aead
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i64.lux
@@ -0,0 +1,123 @@
+(.module:
+ [library
+ [lux (#- or and not)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> parameter subject)])]
+
+ [/.or "Bitwise or."]
+ [/.xor "Bitwise xor."]
+ [/.and "Bitwise and."]
+
+ [/.left_shifted "Bitwise left-shift."]
+ [/.right_shifted "Unsigned/logic bitwise right-shift."]
+ )
+
+(documentation: /.Mask
+ "A pattern of bits that can be imposed on I64 values.")
+
+(documentation: /.bit
+ "A mask with only a specific bit set."
+ [(bit position)])
+
+(documentation: /.sign
+ "A mask for the sign bit of ints.")
+
+(documentation: /.not
+ "Bitwise negation.")
+
+(documentation: /.mask
+ "Mask a block of bits of the specified size."
+ [(mask amount_of_bits)])
+
+(documentation: /.ones
+ "Count the number of 1s in a bit-map."
+ [(ones it)])
+
+(documentation: /.zero
+ "Clear bit at the given index."
+ [(zero index input)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> index input)])]
+
+ [/.one "Set bit at given index."]
+ [/.flipped "Flip bit at given index."]
+ )
+
+(documentation: /.one?
+ ""
+ [(one? index input)])
+
+(documentation: /.zero?
+ ""
+ [(zero? index input)])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> distance input)])]
+
+ [/.left_rotated]
+ [/.right_rotated]
+ )
+
+(documentation: /.region
+ "A mask for a block of bits of the given size, starting at the given offset."
+ [(region offset size)])
+
+(documentation: /.Sub
+ "A sub-space of I64 with a reduce amount of bits.")
+
+(documentation: /.sub
+ "Given a width in the interval (0,64), yields an implementation for integers of that width."
+ [(sub width)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..or
+ ..xor
+ ..and
+ ..left_shifted
+ ..right_shifted
+ ..Mask
+ ..bit
+ ..sign
+ ..not
+ ..mask
+ ..ones
+ ..zero
+ ..one
+ ..flipped
+ ..one?
+ ..zero?
+ ..left_rotated
+ ..right_rotated
+ ..region
+ ..Sub
+ ..sub
+ ($.default /.bits_per_byte)
+ ($.default /.bytes_per_i64)
+ ($.default /.width)
+ ($.default /.false)
+ ($.default /.true)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.disjunction)
+ ($.default /.conjunction)
+ ($.default /.reversed)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/i8.lux b/stdlib/source/documentation/lux/math/number/i8.lux
new file mode 100644
index 000000000..e7022c20e
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/i8.lux
@@ -0,0 +1,25 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.I8
+ "A 8-bit integer.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..I8
+ ($.default /.equivalence)
+ ($.default /.width)
+ ($.default /.i8)
+ ($.default /.i64)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/int.lux b/stdlib/source/documentation/lux/math/number/int.lux
new file mode 100644
index 000000000..fc066a37a
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/int.lux
@@ -0,0 +1,127 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Int(eger) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Int(eger) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Int(eger) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Int(eger) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Int(eger) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Int(eger) minimum."]
+ [/.max "Int(eger) maximum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Int(eger) addition."]
+ [/.- "Int(eger) substraction."]
+ [/.* "Int(eger) multiplication."]
+ [/./ "Int(eger) division."]
+ [/.% "Int(eger) remainder."]
+ [/./% "Int(eger) [division remainder]."]
+ )
+
+(documentation: /.opposite
+ "A value of equal magnitude and opposite sign.")
+
+(documentation: /.abs
+ "A value of equal magnitude and positive sign.")
+
+(documentation: /.signum
+ "A value (either -1, 0 or +0) which represents the sign.")
+
+(documentation: /.mod
+ (format "Integer modulo."
+ \n "Note: The modulo and the remainder are not the same.")
+ [(mod divisor dividend)])
+
+(documentation: /.gcd
+ "Greatest Common Divisor.")
+
+(documentation: /.extended_gcd
+ "Extended euclidean algorithm.")
+
+(documentation: /.lcm
+ "Least Common Multiple.")
+
+(documentation: /.right_shifted
+ "Signed/arithmetic bitwise right-shift."
+ [(right_shifted parameter subject)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..min
+ ..max
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ../%
+ ..opposite
+ ..abs
+ ..signum
+ ..mod
+ ..gcd
+ ..extended_gcd
+ ..lcm
+ ..right_shifted
+ ($.default /.positive?)
+ ($.default /.negative?)
+ ($.default /.zero?)
+ ($.default /.even?)
+ ($.default /.odd?)
+ ($.default /.co_prime?)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.maximum)
+ ($.default /.minimum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.decimal)
+ ($.default /.hex)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/nat.lux b/stdlib/source/documentation/lux/math/number/nat.lux
new file mode 100644
index 000000000..6b0ac7ea9
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/nat.lux
@@ -0,0 +1,82 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <documentation>]
+ [(documentation: <name>
+ <documentation>
+ [(<name> parameter subject)])]
+
+ [/.= "Nat(ural) equivalence."]
+ [/.+ "Nat(ural) addition."]
+ [/.- "Nat(ural) substraction."]
+ [/.< "Nat(ural) less-than."]
+ [/.<= "Nat(ural) less-than or equal."]
+ [/.> "Nat(ural) greater-than."]
+ [/.>= "Nat(ural) greater-than or equal."]
+ [/.* "Nat(ural) multiplication."]
+ [/./ "Nat(ural) division."]
+ [/./% "Nat(ural) [division remainder]."]
+ [/.% "Nat(ural) remainder."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Nat(ural) minimum."]
+ [/.max "Nat(ural) maximum."]
+ )
+
+(documentation: /.gcd
+ "Greatest Common Divisor.")
+
+(documentation: /.lcm
+ "Least Common Multiple.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..+
+ ..-
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..*
+ ../
+ ../%
+ ..%
+ ..min
+ ..max
+ ..gcd
+ ..lcm
+ ($.default /.co_prime?)
+ ($.default /.even?)
+ ($.default /.odd?)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.multiplication)
+ ($.default /.minimum)
+ ($.default /.maximum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.decimal)
+ ($.default /.hash)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/ratio.lux b/stdlib/source/documentation/lux/math/number/ratio.lux
new file mode 100644
index 000000000..7af023084
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/ratio.lux
@@ -0,0 +1,45 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Ratio
+ "An unsigned ratio of numbers.")
+
+(documentation: /.ratio
+ "Rational literals."
+ [(ratio numerator denominator)]
+ ["The denominator can be omitted if it is 1."
+ (ratio numerator)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Rational numbers."
+ [..Ratio
+ ..ratio
+ ($.default /.nat)
+ ($.default /.=)
+ ($.default /.equivalence)
+ ($.default /.<)
+ ($.default /.<=)
+ ($.default /.>)
+ ($.default /.>=)
+ ($.default /.order)
+ ($.default /.+)
+ ($.default /.-)
+ ($.default /.*)
+ ($.default /./)
+ ($.default /.%)
+ ($.default /.reciprocal)
+ ($.default /.codec)
+ ($.default /.addition)
+ ($.default /.multiplication)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/number/rev.lux b/stdlib/source/documentation/lux/math/number/rev.lux
new file mode 100644
index 000000000..1cfce71bb
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/number/rev.lux
@@ -0,0 +1,115 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.=
+ "Rev(olution) equivalence."
+ [(= reference sample)])
+
+(documentation: /.<
+ "Rev(olution) less-than."
+ [(< reference sample)])
+
+(documentation: /.<=
+ "Rev(olution) less-than or equal."
+ [(<= reference sample)])
+
+(documentation: /.>
+ "Rev(olution) greater-than."
+ [(> reference sample)])
+
+(documentation: /.>=
+ "Rev(olution) greater-than or equal."
+ [(>= reference sample)])
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> left right)])]
+
+ [/.min "Rev(olution) minimum."]
+ [/.max "Rev(olution) maximum."]
+ )
+
+(template [<name> <doc>]
+ [(documentation: <name>
+ <doc>
+ [(<name> param subject)])]
+
+ [/.+ "Rev(olution) addition."]
+ [/.- "Rev(olution) substraction."]
+ [/.* "Rev(olution) multiplication."]
+ [/./ "Rev(olution) division."]
+ [/.% "Rev(olution) remainder."]
+ [/.ratio "Ratio between two rev(olution)s."]
+ )
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> scale subject)])]
+
+ [/.up]
+ [/.down]
+ )
+
+(documentation: /.reciprocal
+ "Rev(olution) reciprocal of a Nat(ural)."
+ [(reciprocal numerator)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..=
+ ..<
+ ..<=
+ ..>
+ ..>=
+ ..min
+ ..max
+ ..+
+ ..-
+ ..*
+ ../
+ ..%
+ ..ratio
+ ..up
+ ..down
+ ..reciprocal
+ ($.default /./1)
+ ($.default /./2)
+ ($.default /./4)
+ ($.default /./8)
+ ($.default /./16)
+ ($.default /./32)
+ ($.default /./64)
+ ($.default /./128)
+ ($.default /./256)
+ ($.default /./512)
+ ($.default /./1024)
+ ($.default /./2048)
+ ($.default /./4096)
+ ($.default /./%)
+ ($.default /.frac)
+ ($.default /.equivalence)
+ ($.default /.hash)
+ ($.default /.order)
+ ($.default /.enum)
+ ($.default /.interval)
+ ($.default /.addition)
+ ($.default /.maximum)
+ ($.default /.minimum)
+ ($.default /.binary)
+ ($.default /.octal)
+ ($.default /.hex)
+ ($.default /.decimal)]
+ []))
diff --git a/stdlib/source/documentation/lux/math/random.lux b/stdlib/source/documentation/lux/math/random.lux
new file mode 100644
index 000000000..8dcfb98dd
--- /dev/null
+++ b/stdlib/source/documentation/lux/math/random.lux
@@ -0,0 +1,139 @@
+(.module:
+ [library
+ [lux (#- or and nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.PRNG
+ "An abstract way to represent any PRNG.")
+
+(documentation: /.Random
+ "A producer of random values based on a PRNG.")
+
+(documentation: /.only
+ "Retries the generator until the output satisfies a predicate."
+ [(only pred gen)])
+
+(documentation: /.one
+ ""
+ [(one check random)])
+
+(documentation: /.refined
+ "Retries the generator until the output can be refined."
+ [(refined refiner gen)])
+
+(documentation: /.safe_frac
+ "A number in the interval [0.0,1.0].")
+
+(documentation: /.text
+ ""
+ [(text char_gen size)])
+
+(documentation: /.and
+ "Sequencing combinator."
+ [(and left right)])
+
+(documentation: /.or
+ "Heterogeneous alternative combinator."
+ [(or left right)])
+
+(documentation: /.either
+ "Homogeneous alternative combinator."
+ [(either left right)])
+
+(documentation: /.rec
+ "A combinator for producing recursive random generators."
+ [(rec gen)])
+
+(documentation: /.set
+ ""
+ [(set hash size value_gen)])
+
+(documentation: /.dictionary
+ ""
+ [(dictionary hash size key_gen value_gen)])
+
+(documentation: /.result
+ ""
+ [(result prng calc)])
+
+(documentation: /.prng
+ ""
+ [(prng update return)])
+
+(documentation: /.pcg_32
+ (format "An implementation of the PCG32 algorithm."
+ \n "For more information, please see: http://www.pcg-random.org/"))
+
+(documentation: /.xoroshiro_128+
+ (format "An implementation of the Xoroshiro128+ algorithm."
+ \n "For more information, please see: http://xoroshiro.di.unimi.it/"))
+
+(documentation: /.split_mix_64
+ "An implementation of the SplitMix64 algorithm.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Pseudo-random number generation (PRNG) algorithms."
+ [..PRNG
+ ..Random
+ ..only
+ ..one
+ ..refined
+ ..safe_frac
+ ..text
+ ..and
+ ..or
+ ..either
+ ..rec
+ ..set
+ ..dictionary
+ ..result
+ ..prng
+ ..pcg_32
+ ..xoroshiro_128+
+ ..split_mix_64
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+
+ ($.default /.bit)
+ ($.default /.i64)
+ ($.default /.nat)
+ ($.default /.int)
+ ($.default /.rev)
+ ($.default /.frac)
+ ($.default /.char)
+
+ ($.default /.unicode)
+ ($.default /.ascii)
+ ($.default /.ascii/alpha)
+ ($.default /.ascii/alpha_num)
+ ($.default /.ascii/numeric)
+ ($.default /.ascii/upper)
+ ($.default /.ascii/lower)
+
+ ($.default /.ratio)
+ ($.default /.complex)
+
+ ($.default /.maybe)
+ ($.default /.list)
+ ($.default /.row)
+ ($.default /.array)
+ ($.default /.queue)
+ ($.default /.stack)
+
+ ($.default /.instant)
+ ($.default /.date)
+ ($.default /.time)
+ ($.default /.duration)
+ ($.default /.month)
+ ($.default /.day)]
+ []))