aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation')
-rw-r--r--stdlib/source/documentation/lux.lux16
-rw-r--r--stdlib/source/documentation/lux/abstract.lux4
-rw-r--r--stdlib/source/documentation/lux/abstract/mix.lux (renamed from stdlib/source/documentation/lux/abstract/fold.lux)8
-rw-r--r--stdlib/source/documentation/lux/abstract/monad.lux8
-rw-r--r--stdlib/source/documentation/lux/control/concurrency/frp.lux10
-rw-r--r--stdlib/source/documentation/lux/control/pipe.lux4
-rw-r--r--stdlib/source/documentation/lux/data/collection/array.lux2
-rw-r--r--stdlib/source/documentation/lux/data/collection/list.lux8
-rw-r--r--stdlib/source/documentation/lux/data/collection/row.lux2
-rw-r--r--stdlib/source/documentation/lux/data/color.lux25
-rw-r--r--stdlib/source/documentation/lux/data/color/named.lux8
-rw-r--r--stdlib/source/documentation/lux/data/product.lux2
-rw-r--r--stdlib/source/documentation/lux/data/text/encoding/utf8.lux5
-rw-r--r--stdlib/source/documentation/lux/data/text/unicode/block.lux6
-rw-r--r--stdlib/source/documentation/lux/macro/template.lux2
-rw-r--r--stdlib/source/documentation/lux/math.lux73
-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
-rw-r--r--stdlib/source/documentation/lux/meta.lux196
-rw-r--r--stdlib/source/documentation/lux/meta/annotation.lux56
-rw-r--r--stdlib/source/documentation/lux/meta/location.lux30
-rw-r--r--stdlib/source/documentation/lux/static.lux70
-rw-r--r--stdlib/source/documentation/lux/target.lux32
37 files changed, 1560 insertions, 64 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux
index 4a964e552..ac01ef0f1 100644
--- a/stdlib/source/documentation/lux.lux
+++ b/stdlib/source/documentation/lux.lux
@@ -17,13 +17,14 @@
["#." ffi]
["#." locale]
["#." macro]
- ... ["#." math]
- ... ["#." meta]
+ ["#." math]
+ ["#." meta]
["#." program]
- ... ["#." target]
+ ["#." static]
+ ["#." target]
... ["#." test]
... ["#." time]
- ... ... ["#." tool] ... TODO: Update & expand tests for this
+ ... ... ["#." tool] ... TODO: Documentation for this
... ["#." type]
... ["#." world]
... ["#." extension]
@@ -44,8 +45,11 @@
/ffi.documentation
/locale.documentation
/macro.documentation
-
- /program.documentation]))
+ /math.documentation
+ /meta.documentation
+ /program.documentation
+ /static.documentation
+ /target.documentation]))
(program: inputs
(io.io (debug.log! ($.documentation ..documentation))))
diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux
index a8c0d3b03..11d002127 100644
--- a/stdlib/source/documentation/lux/abstract.lux
+++ b/stdlib/source/documentation/lux/abstract.lux
@@ -13,7 +13,7 @@
["#." comonad]
["#." enum]
["#." equivalence]
- ["#." fold]
+ ["#." mix]
["#." functor]
["#." hash]
["#." interval]
@@ -30,7 +30,7 @@
/comonad.documentation
/enum.documentation
/equivalence.documentation
- /fold.documentation
+ /mix.documentation
/functor.documentation
/hash.documentation
/interval.documentation
diff --git a/stdlib/source/documentation/lux/abstract/fold.lux b/stdlib/source/documentation/lux/abstract/mix.lux
index 33a12a91c..73b23e628 100644
--- a/stdlib/source/documentation/lux/abstract/fold.lux
+++ b/stdlib/source/documentation/lux/abstract/mix.lux
@@ -8,17 +8,17 @@
[\\library
["." /]])
-(documentation: /.Fold
+(documentation: /.Mix
"Iterate over a structure's values to build a summary value.")
(documentation: /.with_monoid
- "Fold over a foldable structure using the monoid's identity as the initial value."
- [(with_monoid monoid fold value)])
+ "Mix a mixable structure using the monoid's identity as the initial value."
+ [(with_monoid monoid mix value)])
(.def: .public documentation
(.List $.Module)
($.module /._
""
- [..Fold
+ [..Mix
..with_monoid]
[]))
diff --git a/stdlib/source/documentation/lux/abstract/monad.lux b/stdlib/source/documentation/lux/abstract/monad.lux
index 07318bce9..cdf12eedf 100644
--- a/stdlib/source/documentation/lux/abstract/monad.lux
+++ b/stdlib/source/documentation/lux/abstract/monad.lux
@@ -37,9 +37,9 @@
"Filter the values in a list with a monadic function."
[(only monad predicate items)])
-(documentation: /.fold
- "Fold a list with a monadic function."
- [(fold monad function initial_value items)])
+(documentation: /.mix
+ "Mix a list with a monadic function."
+ [(mix monad function initial_value items)])
(.def: .public documentation
(.List $.Module)
@@ -51,5 +51,5 @@
..all
..map
..only
- ..fold]
+ ..mix]
[/free.documentation]))
diff --git a/stdlib/source/documentation/lux/control/concurrency/frp.lux b/stdlib/source/documentation/lux/control/concurrency/frp.lux
index 728e93be5..74ddc31e2 100644
--- a/stdlib/source/documentation/lux/control/concurrency/frp.lux
+++ b/stdlib/source/documentation/lux/control/concurrency/frp.lux
@@ -32,9 +32,9 @@
"A one-element channel containing the output from an async."
[(of_async async)])
-(documentation: /.aggregate
- "Asynchronous fold over channels."
- [(aggregate f init channel)])
+(documentation: /.mix
+ "Asynchronous mix over channels."
+ [(mix f init channel)])
(documentation: /.sequential
"Transforms the given list into a channel with the same elements."
@@ -50,14 +50,14 @@
..Subscriber
..only
..of_async
- ..aggregate
+ ..mix
..sequential
($.default /.channel_is_already_closed)
($.default /.functor)
($.default /.apply)
($.default /.monad)
($.default /.subscribe!)
- ($.default /.aggregates)
+ ($.default /.mixes)
($.default /.poll)
($.default /.periodic)
($.default /.iterations)
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux
index f18415290..284a2ec20 100644
--- a/stdlib/source/documentation/lux/control/pipe.lux
+++ b/stdlib/source/documentation/lux/control/pipe.lux
@@ -80,7 +80,7 @@
[(|> +5
(tuple> [(i.* +10)]
[-- (i./ +2)]
- [i\encode]))
+ [i\encoded]))
"=>"
[+50 +2 "+5"]])
@@ -103,7 +103,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."
[..new>
..let>
..cond>
diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux
index 3bf22b587..e36cba1a8 100644
--- a/stdlib/source/documentation/lux/data/collection/array.lux
+++ b/stdlib/source/documentation/lux/data/collection/array.lux
@@ -118,7 +118,7 @@
($.default /.equivalence)
($.default /.monoid)
($.default /.functor)
- ($.default /.fold)
+ ($.default /.mix)
($.default /.every?)
($.default /.any?)]
[]))
diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux
index 1050ab7ce..87cf01da1 100644
--- a/stdlib/source/documentation/lux/data/collection/list.lux
+++ b/stdlib/source/documentation/lux/data/collection/list.lux
@@ -15,9 +15,9 @@
[\\library
["." /]])
-(documentation: /.aggregates
+(documentation: /.mixes
""
- [(aggregates f init inputs)])
+ [(mixes f init inputs)])
(documentation: /.reversed
""
@@ -181,7 +181,7 @@
(.List $.Module)
($.module /._
""
- [..aggregates
+ [..mixes
..reversed
..only
..partition
@@ -225,7 +225,7 @@
..lifted
..enumeration
..when
- ($.default /.fold)
+ ($.default /.mix)
($.default /.equivalence)
($.default /.hash)
($.default /.monoid)
diff --git a/stdlib/source/documentation/lux/data/collection/row.lux b/stdlib/source/documentation/lux/data/collection/row.lux
index e72e8974e..a49b12bd4 100644
--- a/stdlib/source/documentation/lux/data/collection/row.lux
+++ b/stdlib/source/documentation/lux/data/collection/row.lux
@@ -75,7 +75,7 @@
($.default /.of_list)
($.default /.empty?)
($.default /.equivalence)
- ($.default /.fold)
+ ($.default /.mix)
($.default /.monoid)
($.default /.functor)
($.default /.apply)
diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux
index 96a44b6ed..2a439f7c3 100644
--- a/stdlib/source/documentation/lux/data/color.lux
+++ b/stdlib/source/documentation/lux/data/color.lux
@@ -77,6 +77,19 @@
(documentation: /.Pigment
"A color with some degree of transparency.")
+(template [<name>]
+ [(`` (documentation: <name>
+ (format "A "
+ (text.replaced "_" "-" (~~ (template.text [<name>])))
+ " color scheme.")))]
+
+ [/.triad]
+ [/.clash]
+ [/.split_complement]
+ [/.square]
+ [/.tetradic]
+ )
+
(.def: .public documentation
(.List $.Module)
($.module /._
@@ -101,6 +114,13 @@
..translucent
..opaque
..Pigment
+
+ ..triad
+ ..clash
+ ..split_complement
+ ..square
+ ..tetradic
+
($.default /.of_rgb)
($.default /.rgb)
($.default /.equivalence)
@@ -116,11 +136,6 @@
($.default /.cmyk)
($.default /.of_cmyk)
($.default /.gray_scale)
- ($.default /.triad)
- ($.default /.clash)
- ($.default /.split_complement)
- ($.default /.square)
- ($.default /.tetradic)
($.default /.Spread)
($.default /.Palette)]
[/named.documentation]))
diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux
index 6f9a080eb..b0a6d88ba 100644
--- a/stdlib/source/documentation/lux/data/color/named.lux
+++ b/stdlib/source/documentation/lux/data/color/named.lux
@@ -14,7 +14,7 @@
["." template]]
[math
[number
- ["." nat ("#\." hex)]]]]]
+ ["." nat ("hex\." hex)]]]]]
[\\library
["." /
["/#" //]]])
@@ -23,9 +23,9 @@
[(documentation: <name>
(let [[red green blue] (//.rgb <name>)
[_ name] (name_of <name>)]
- (format "R:" (nat\encode red)
- " G:" (nat\encode green)
- " B:" (nat\encode blue)
+ (format "R:" (hex\encoded red)
+ " G:" (hex\encoded green)
+ " B:" (hex\encoded blue)
" | " (text.replaced "_" " " name))))]
[/.alice_blue]
diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux
index 78d0d5aaa..f1abaffcd 100644
--- a/stdlib/source/documentation/lux/data/product.lux
+++ b/stdlib/source/documentation/lux/data/product.lux
@@ -39,7 +39,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Functionality for working with tuples (particularly 2-tuples/pairs)."
[..left
..right
..curried
diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
index cfe8aee01..dc9a199f3 100644
--- a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux
@@ -10,9 +10,12 @@
[\\library
["." /]])
+(documentation: /.codec
+ "A codec for binary encoding of text as UTF-8.")
+
(.def: .public documentation
(.List $.Module)
($.module /._
""
- [($.default /.codec)]
+ [..codec]
[]))
diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux
index 703ac9f58..faa9d8833 100644
--- a/stdlib/source/documentation/lux/data/text/unicode/block.lux
+++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux
@@ -9,7 +9,7 @@
["." template]]
[math
[number
- ["." nat ("#\." hex)]]]]]
+ ["." nat ("hex\." hex)]]]]]
[\\library
["." /]])
@@ -27,8 +27,8 @@
(template [<name>]
[(documentation: <name>
(let [[_ name] (name_of <name>)]
- (format (nat\encode (/.start <name>))
- "-" (nat\encode (/.end <name>))
+ (format (hex\encoded (/.start <name>))
+ "-" (hex\encoded (/.end <name>))
" | " (text.replaced "_" " " name))))]
[/.basic_latin]
diff --git a/stdlib/source/documentation/lux/macro/template.lux b/stdlib/source/documentation/lux/macro/template.lux
index 894d68c3d..7b2d0bf2e 100644
--- a/stdlib/source/documentation/lux/macro/template.lux
+++ b/stdlib/source/documentation/lux/macro/template.lux
@@ -65,7 +65,7 @@
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
+ "Utilities commonly used while templating."
[..spliced
..amount
..with_locals
diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux
index 7c74692ca..f41afe130 100644
--- a/stdlib/source/documentation/lux/math.lux
+++ b/stdlib/source/documentation/lux/math.lux
@@ -9,20 +9,73 @@
["." list]]]]]
["." / #_
["#." infix]
- ... ["#." modulus]
- ... ["#." modular]
- ... ["#." number]
- ["#." logic]]
+ ["#." modulus]
+ ["#." modular]
+ ["#." number]
+ ["#." logic]
+ ["#." random]]
[\\library
["." /]])
+(documentation: /.e
+ "The base of the natural logarithm.")
+
+(documentation: /.pi
+ "The ratio of a circle's circumference to its diameter.")
+
+(documentation: /.tau
+ "The ratio of a circle's circumference to its radius.")
+
+(documentation: /.pow
+ ""
+ [(pow param subject)])
+
+(documentation: /.atan/2
+ ""
+ [(atan/2 x y)])
+
+(documentation: /.log'
+ ""
+ [(log' base it)])
+
(.def: .public documentation
(.List $.Module)
($.module /._
- ""
- []
+ "Common mathematical constants and functions."
+ [..e
+ ..pi
+ ..tau
+ ..pow
+ ..atan/2
+ ..log'
+ ($.default /.cos)
+ ($.default /.sin)
+ ($.default /.tan)
+ ($.default /.acos)
+ ($.default /.asin)
+ ($.default /.atan)
+ ($.default /.exp)
+ ($.default /.log)
+ ($.default /.ceil)
+ ($.default /.floor)
+ ($.default /.root/2)
+ ($.default /.root/3)
+ ($.default /.round)
+ ($.default /.factorial)
+ ($.default /.hypotenuse)
+ ($.default /.sinh)
+ ($.default /.cosh)
+ ($.default /.tanh)
+ ($.default /.coth)
+ ($.default /.asinh)
+ ($.default /.acosh)
+ ($.default /.atanh)
+ ($.default /.acoth)
+ ($.default /.asech)
+ ($.default /.acsch)]
[/infix.documentation
- ... /modulus.documentation
- ... /modular.documentation
- ... /number.documentation
- /logic.documentation]))
+ /modulus.documentation
+ /modular.documentation
+ /number.documentation
+ /logic.documentation
+ /random.documentation]))
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)]
+ []))
diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux
new file mode 100644
index 000000000..4b6c549bf
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta.lux
@@ -0,0 +1,196 @@
+(.module:
+ [library
+ [lux (#- type)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." annotation]
+ ["#." location]])
+
+(documentation: /.result'
+ (format "Evaluates a computation that depends on Lux's compiler state."
+ \n "Also returns a (potentially modified) compiler state.")
+ [(result' lux action)])
+
+(documentation: /.result
+ "Evaluates a computation that depends on Lux's compiler state."
+ [(result lux action)])
+
+(documentation: /.either
+ "Pick whichever computation succeeds."
+ [(either left right)])
+
+(documentation: /.assertion
+ "Fails with the given message if the test is #0."
+ [(assertion message test)])
+
+(documentation: /.failure
+ "Fails with the given error message."
+ [(failure error)])
+
+(documentation: /.module
+ "Looks-up a module with the given name."
+ [(module name)])
+
+(documentation: /.current_module_name
+ "The name of the module currently being compiled, if any.")
+
+(documentation: /.current_module
+ "The module currently being compiled, if any.")
+
+(documentation: /.normal
+ (format "If given a name without a module prefix, gives it the current module's name as prefix."
+ \n "Otherwise, returns the name as-is.")
+ [(normal name)])
+
+(documentation: /.macro
+ "Looks-up a macro known by the given name."
+ [(macro full_name)])
+
+(documentation: /.seed
+ (format "The current value of a number tracked by the compiler."
+ \n "Also increases the value, so it's different next time it is seen."
+ \n "This number can be used for generating data 'randomly' during compilation."))
+
+(documentation: /.module_exists?
+ ""
+ [(module_exists? module)])
+
+(documentation: /.var_type
+ "Looks-up the type of a local variable somewhere in the environment."
+ [(var_type name)])
+
+(documentation: /.definition
+ "Looks-up a definition's whole data in the available modules (including the current one)."
+ [(definition name)])
+
+(documentation: /.export
+ (format "Looks-up a definition in the available modules (including the current one)."
+ \n "The look-up only succeeds if the definition has been exported.")
+ [(export name)])
+
+(documentation: /.definition_type
+ "Looks-up a definition's type in the available modules (including the current one)."
+ [(definition_type name)])
+
+(documentation: /.type
+ "Looks-up the type of either a local variable or a definition."
+ [(type name)])
+
+(documentation: /.type_definition
+ "Finds the value of a type definition (such as Int, Any or Lux)."
+ [(type_definition name)])
+
+(documentation: /.globals
+ "The entire list of globals in a module (including the non-exported/private ones)."
+ [(globals module)])
+
+(documentation: /.definitions
+ "The entire list of definitions in a module (including the non-exported/private ones)."
+ [(definitions module)])
+
+(documentation: /.exports
+ "All the exported definitions in a module."
+ [(exports module_name)])
+
+(documentation: /.modules
+ "All the available modules (including the current one).")
+
+(documentation: /.tags_of
+ "All the tags associated with a type definition."
+ [(tags_of type_name)])
+
+(documentation: /.location
+ "The location of the current expression being analyzed.")
+
+(documentation: /.expected_type
+ "The expected type of the current expression being analyzed.")
+
+(documentation: /.imported_modules
+ "All the modules imported by a specified module."
+ [(imported_modules module_name)])
+
+(documentation: /.imported_by?
+ ""
+ [(imported_by? import module)])
+
+(documentation: /.imported?
+ "Checks if the given module has been imported by the current module."
+ [(imported? import)])
+
+(documentation: /.tag
+ "Given a tag, finds out what is its index, its related tag-list and its associated type."
+ [(tag tag_name)])
+
+(documentation: /.tag_lists
+ "All the tag-lists defined in a module, with their associated types."
+ [(tag_lists module)])
+
+(documentation: /.locals
+ "All the local variables currently in scope, separated in different scopes.")
+
+(documentation: /.de_aliased
+ "Given an aliased definition's name, returns the original definition being referenced."
+ [(de_aliased def_name)])
+
+(documentation: /.compiler_state
+ "Obtains the current state of the compiler.")
+
+(documentation: /.type_context
+ "The current type-checking context.")
+
+(documentation: /.eval
+ ""
+ [(eval type code)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Functions for extracting information from the state of the compiler."
+ [..result'
+ ..result
+ ..either
+ ..assertion
+ ..failure
+ ..module
+ ..current_module_name
+ ..current_module
+ ..normal
+ ..macro
+ ..seed
+ ..module_exists?
+ ..var_type
+ ..definition
+ ..export
+ ..definition_type
+ ..type
+ ..type_definition
+ ..globals
+ ..definitions
+ ..exports
+ ..modules
+ ..tags_of
+ ..location
+ ..expected_type
+ ..imported_modules
+ ..imported_by?
+ ..imported?
+ ..tag
+ ..tag_lists
+ ..locals
+ ..de_aliased
+ ..compiler_state
+ ..type_context
+ ..eval
+ ($.default /.functor)
+ ($.default /.apply)
+ ($.default /.monad)
+ ($.default /.lifted)]
+ [/annotation.documentation
+ /location.documentation]))
diff --git a/stdlib/source/documentation/lux/meta/annotation.lux b/stdlib/source/documentation/lux/meta/annotation.lux
new file mode 100644
index 000000000..42582dad5
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta/annotation.lux
@@ -0,0 +1,56 @@
+(.module:
+ [library
+ [lux (#- nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name>]
+ [(documentation: <name>
+ ""
+ [(<name> tag ann)])]
+
+ [/.value]
+ [/.bit]
+ [/.nat]
+ [/.int]
+ [/.rev]
+ [/.frac]
+ [/.text]
+ [/.identifier]
+ [/.tag]
+ [/.form]
+ [/.tuple]
+ [/.record]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ "Machinary for querying annotations on modules and definitions."
+ [..value
+ ..bit
+ ..nat
+ ..int
+ ..rev
+ ..frac
+ ..text
+ ..identifier
+ ..tag
+ ..form
+ ..tuple
+ ..record
+ ($.default /.Annotation)
+ ($.default /.documentation)
+ ($.default /.flagged?)
+ ($.default /.implementation?)
+ ($.default /.recursive_type?)
+ ($.default /.interface?)
+ ($.default /.function_arguments)
+ ($.default /.type_arguments)]
+ []))
diff --git a/stdlib/source/documentation/lux/meta/location.lux b/stdlib/source/documentation/lux/meta/location.lux
new file mode 100644
index 000000000..6a32244b2
--- /dev/null
+++ b/stdlib/source/documentation/lux/meta/location.lux
@@ -0,0 +1,30 @@
+(.module:
+ [library
+ [lux (#- private)
+ ["$" documentation (#+ documentation:)]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.here
+ "The Location of the current form."
+ [(here)])
+
+(documentation: /.with
+ ""
+ [(with location error)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..here
+ ..with
+ ($.default /.equivalence)
+ ($.default /.dummy)
+ ($.default /.format)]
+ []))
diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux
new file mode 100644
index 000000000..654409252
--- /dev/null
+++ b/stdlib/source/documentation/lux/static.lux
@@ -0,0 +1,70 @@
+(.module:
+ [library
+ [lux (#- nat int rev)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(template [<name> <type>]
+ [(documentation: <name>
+ ""
+ [(<name>
+ (: <type>
+ (value generating expression)))])]
+
+ [/.nat .Nat]
+ [/.int .Int]
+ [/.rev .Rev]
+ [/.frac .Frac]
+ [/.text .Text]
+ )
+
+(documentation: /.literal
+ ""
+ [(/.literal
+ (: (-> ??? Code)
+ format)
+ (: ???
+ (value generating expression)))])
+
+(template [<name> <type>]
+ [(documentation: <name>
+ ""
+ [(: <type>
+ (<name>))])]
+
+ [/.random_nat .Nat]
+ [/.random_int .Int]
+ [/.random_rev .Rev]
+ [/.random_frac .Frac]
+ )
+
+(documentation: /.random
+ ""
+ [(/.random
+ (: (-> ??? Code)
+ format)
+ (: (Random ???)
+ (random data generator)))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..nat
+ ..int
+ ..rev
+ ..frac
+ ..text
+ ..literal
+ ..random_nat
+ ..random_int
+ ..random_rev
+ ..random_frac
+ ..random]
+ []))
diff --git a/stdlib/source/documentation/lux/target.lux b/stdlib/source/documentation/lux/target.lux
new file mode 100644
index 000000000..9e408ae0f
--- /dev/null
+++ b/stdlib/source/documentation/lux/target.lux
@@ -0,0 +1,32 @@
+(.module:
+ [library
+ [lux (#- char)
+ ["$" documentation (#+ documentation:)]
+ [data
+ [text (#+ \n)
+ ["%" format (#+ format)]]
+ [collection
+ ["." list]]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Target
+ (format "The name/ID of a platform targetted by a Lux compiler."
+ \n "This information can be used to generate code targetting specific platforms, and to make programs cross-platform."))
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Target
+ ($.default /.old)
+ ($.default /.js)
+ ($.default /.jvm)
+ ($.default /.lua)
+ ($.default /.python)
+ ($.default /.ruby)
+ ($.default /.common_lisp)
+ ($.default /.php)
+ ($.default /.r)
+ ($.default /.scheme)]
+ []))