diff options
Diffstat (limited to 'stdlib/source/documentation/lux/math/number')
-rw-r--r-- | stdlib/source/documentation/lux/math/number/complex.lux | 64 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/frac.lux | 127 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/i16.lux | 25 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/i32.lux | 25 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/i64.lux | 123 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/i8.lux | 25 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/int.lux | 127 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/nat.lux | 82 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/ratio.lux | 45 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/math/number/rev.lux | 115 |
10 files changed, 758 insertions, 0 deletions
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)] + [])) |