From 06f5b1c544ad27eecfbc7cc9b3bd7591f9e33423 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 6 Jan 2023 12:55:42 -0400 Subject: Now documenting exported aliases. --- stdlib/source/documentation/lux.lux | 4 +- stdlib/source/documentation/lux/data.lux | 98 +++++++++++++++++- stdlib/source/documentation/lux/data/color.lux | 112 --------------------- .../source/documentation/lux/data/color/named.lux | 10 +- stdlib/source/documentation/lux/math.lux | 7 +- .../documentation/lux/math/arithmetic/infix.lux | 48 +++++++++ .../documentation/lux/math/arithmetic/modular.lux | 49 +++++++++ stdlib/source/documentation/lux/math/infix.lux | 48 --------- stdlib/source/documentation/lux/math/modular.lux | 49 --------- stdlib/source/documentation/lux/meta.lux | 4 +- .../lux/meta/compiler/language/lux/translation.lux | 4 - stdlib/source/documentation/lux/meta/extension.lux | 5 +- 12 files changed, 209 insertions(+), 229 deletions(-) delete mode 100644 stdlib/source/documentation/lux/data/color.lux create mode 100644 stdlib/source/documentation/lux/math/arithmetic/infix.lux create mode 100644 stdlib/source/documentation/lux/math/arithmetic/modular.lux delete mode 100644 stdlib/source/documentation/lux/math/infix.lux delete mode 100644 stdlib/source/documentation/lux/math/modular.lux (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 13b7e6d8a..0e2454aab 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -601,7 +601,7 @@ [// [type (.use "[0]" equivalence)]]))) - ($.definition /.at + ($.definition /.of "Allows accessing the value of a implementation's member." ($.example (of codec encoded)) @@ -792,6 +792,8 @@ ($.example (same? +5 (+ +2 +3)))) + ($.alias /.alias?) + ... ($.definition /.^let ... "Allows you to simultaneously bind and de-structure a value." ... ($.example (def (hash (^let set [member_hash _])) diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux index 93ecf8753..9f0f9d036 100644 --- a/stdlib/source/documentation/lux/data.lux +++ b/stdlib/source/documentation/lux/data.lux @@ -9,20 +9,114 @@ ["[1][0]" binary] ["[1][0]" bit] ["[1][0]" collection] - ["[1][0]" color] + ["[1][0]" color + ["[1]/[0]" named]] ["[1][0]" format] ["[1][0]" identity] ["[1][0]" product] ["[1][0]" sum] ["[1][0]" text]]) +... (def palette_documentation +... (syntax (_ [[_ name] .symbol]) +... (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))) + +... (`` (def .public documentation +... (List $.Documentation) +... (let [encoding (list ($.definition /.of_rgb) +... ($.definition /.rgb) + +... ($.definition /.HSL +... "Hue-Saturation-Lightness color format.") + +... ($.definition /.hsl) +... ($.definition /.of_hsl) + +... ($.definition /.hsb) +... ($.definition /.of_hsb) + +... ($.definition /.HSB +... "Hue-Saturation-Brightness color format.")) +... transformation (list ($.definition /.gray_scale) +... ($.definition /.darker) +... ($.definition /.brighter) +... ($.definition /.saturated) +... ($.definition /.un_saturated) + +... ($.definition /.complement +... "The opposite color." +... ($.example (complement color))) + +... ($.definition /.interpolated +... "" +... ($.example (interpolated ratio end start)))) +... alpha (list ($.definition /.Alpha +... "The degree of transparency of a pigment.") + +... ($.definition /.transparent +... "The maximum degree of transparency.") + +... ($.definition /.translucent +... "The medium degree of transparency.") + +... ($.definition /.opaque +... "The minimum degree of transparency.")) +... scheme (list ($.definition /.Spread) +... ($.definition /.Palette) + +... ($.definition /.analogous +... (palette_documentation /.analogous) +... ($.example (analogous spread variations color))) + +... ($.definition /.monochromatic +... (palette_documentation /.monochromatic) +... ($.example (monochromatic spread variations color))) + +... (,, (with_template [] +... [(`` ($.definition +... (format "A " +... (text.replaced "_" "-" (,, (template.text []))) +... " color scheme.")))] + +... [/.triad] +... [/.clash] +... [/.split_complement] +... [/.square] +... [/.tetradic] +... )))] +... (list.partial ($.module /._ +... "") + +... ($.definition /.Color +... "A color value, independent of color format.") + +... ($.definition /.equivalence) +... ($.definition /.hash) +... ($.definition /.black) +... ($.definition /.white) +... ($.definition /.addition) +... ($.definition /.subtraction) + +... ($.definition /.Pigment +... "A color with some degree of transparency.") + +... (all list#composite +... encoding +... transformation +... alpha +... scheme + +... /named.documentation +... ) +... )))) + (def .public documentation (List $.Documentation) (list.together (list /binary.documentation /bit.documentation /collection.documentation - /color.documentation + /color/named.documentation /format.documentation /identity.documentation /product.documentation diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux deleted file mode 100644 index 768fb1ffb..000000000 --- a/stdlib/source/documentation/lux/data/color.lux +++ /dev/null @@ -1,112 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]] - [collection - ["[0]" list (.use "[1]#[0]" monoid)]]] - [meta - ["[0]" code (.only) - ["<[1]>" \\parser]] - [macro - [syntax (.only syntax)] - ["[0]" template]]]]] - [\\library - ["[0]" /]] - ["[0]" / - ["[1][0]" named]]) - -(def palette_documentation - (syntax (_ [[_ name] .symbol]) - (in (list (code.text (format "A " (text.replaced "_" "-" name) " palette.")))))) - -(`` (def .public documentation - (List $.Documentation) - (let [encoding (list ($.definition /.of_rgb) - ($.definition /.rgb) - - ($.definition /.HSL - "Hue-Saturation-Lightness color format.") - - ($.definition /.hsl) - ($.definition /.of_hsl) - - ($.definition /.hsb) - ($.definition /.of_hsb) - - ($.definition /.HSB - "Hue-Saturation-Brightness color format.")) - transformation (list ($.definition /.gray_scale) - ($.definition /.darker) - ($.definition /.brighter) - ($.definition /.saturated) - ($.definition /.un_saturated) - - ($.definition /.complement - "The opposite color." - ($.example (complement color))) - - ($.definition /.interpolated - "" - ($.example (interpolated ratio end start)))) - alpha (list ($.definition /.Alpha - "The degree of transparency of a pigment.") - - ($.definition /.transparent - "The maximum degree of transparency.") - - ($.definition /.translucent - "The medium degree of transparency.") - - ($.definition /.opaque - "The minimum degree of transparency.")) - scheme (list ($.definition /.Spread) - ($.definition /.Palette) - - ($.definition /.analogous - (palette_documentation /.analogous) - ($.example (analogous spread variations color))) - - ($.definition /.monochromatic - (palette_documentation /.monochromatic) - ($.example (monochromatic spread variations color))) - - (,, (with_template [] - [(`` ($.definition - (format "A " - (text.replaced "_" "-" (,, (template.text []))) - " color scheme.")))] - - [/.triad] - [/.clash] - [/.split_complement] - [/.square] - [/.tetradic] - )))] - (list.partial ($.module /._ - "") - - ($.definition /.Color - "A color value, independent of color format.") - - ($.definition /.equivalence) - ($.definition /.hash) - ($.definition /.black) - ($.definition /.white) - ($.definition /.addition) - ($.definition /.subtraction) - - ($.definition /.Pigment - "A color with some degree of transparency.") - - (all list#composite - encoding - transformation - alpha - scheme - - /named.documentation - ) - )))) diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index 49eb0847d..fe90ee829 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -12,17 +12,17 @@ ["[0]" nat (.use "hex#[0]" hex)]]]]] [\\library ["[0]" / (.only) - ["/[1]" // (.only) + [// ["[0]" rgb]]]]) (def description (template (_ ) [($.definition - (let [[red green blue] (//.rgb ) + (let [[red green blue] [_ name] (symbol )] - (format "R:" (hex#encoded (rgb.number red)) - " G:" (hex#encoded (rgb.number green)) - " B:" (hex#encoded (rgb.number blue)) + (format "R:" (hex#encoded red) + " G:" (hex#encoded green) + " B:" (hex#encoded blue) " | " (text.replaced "_" " " name))))])) (`` (def .public documentation diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux index afc959c96..c2ae9b908 100644 --- a/stdlib/source/documentation/lux/math.lux +++ b/stdlib/source/documentation/lux/math.lux @@ -8,12 +8,13 @@ [collection ["[0]" list (.use "[1]#[0]" monoid)]]]]] ["[0]" / - ["[1][0]" infix] ["[1][0]" modulus] - ["[1][0]" modular] ["[1][0]" number] ["[1][0]" logic] - ["[1][0]" random]] + ["[1][0]" random] + [arithmetic + ["[1][0]" infix] + ["[1][0]" modular]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/math/arithmetic/infix.lux b/stdlib/source/documentation/lux/math/arithmetic/infix.lux new file mode 100644 index 000000000..5b3d00381 --- /dev/null +++ b/stdlib/source/documentation/lux/math/arithmetic/infix.lux @@ -0,0 +1,48 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]]]] + [\\library + ["[0]" /]]) + +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.infix + (format "Infix math syntax." + \n "The rules for infix syntax are simple." + \n "If you want your binary function to work well with it." + \n "Then take the argument to the right (y) as your first argument," + \n "and take the argument to the left (x) as your second argument.") + + ($.comment "Binary functions") + ($.example (infix [x * +10])) + ($.comment "=>") + ($.example (* +10 x)) + + ($.comment "Nested infix") + ($.example (infix [[x + y] * [x - y]])) + ($.comment "=>") + ($.example (* (- y x) (+ y x))) + + ($.comment "Unary functions") + ($.example (infix [sin [x + y]])) + ($.comment "=>") + ($.example (sin (+ y x))) + + ($.comment "Also works with logic") + ($.example (infix [[x < y] and [y < z]])) + ($.comment "=>") + ($.example (and (< z y) + (< y x))) + + ($.comment "Forms are left as-is") + ($.example (infix [(* 3 9) gcd 450])) + ($.comment "=>") + ($.example (gcd 450 (* 3 9)))) + )) diff --git a/stdlib/source/documentation/lux/math/arithmetic/modular.lux b/stdlib/source/documentation/lux/math/arithmetic/modular.lux new file mode 100644 index 000000000..64d76ae02 --- /dev/null +++ b/stdlib/source/documentation/lux/math/arithmetic/modular.lux @@ -0,0 +1,49 @@ +(.require + [library + [lux (.except) + ["$" documentation] + [data + ["[0]" text (.only \n) + ["%" \\format (.only format)]]]]] + [\\library + ["[0]" /]]) + +(def .public documentation + (List $.Documentation) + (list ($.module /._ + "") + + ($.definition /.modulus) + ($.definition /.value) + ($.definition /.incorrect_modulus) + ($.definition /.codec) + + ($.definition /.=) + ($.definition /.<) + ($.definition /.<=) + ($.definition /.>) + ($.definition /.>=) + + ($.definition /.equivalence) + ($.definition /.order) + + ($.definition /.+) + ($.definition /.-) + ($.definition /.*) + + ($.definition /.addition) + ($.definition /.multiplication) + ($.definition /.inverse) + ($.definition /.moduli_are_not_equal) + + ($.definition (/.Mod %) + "A number under a modulus.") + + ($.definition /.modular + "" + ($.example (modular modulus value))) + + ($.definition /.adapter + "" + ($.example (adapter reference subject))) + )) diff --git a/stdlib/source/documentation/lux/math/infix.lux b/stdlib/source/documentation/lux/math/infix.lux deleted file mode 100644 index 5b3d00381..000000000 --- a/stdlib/source/documentation/lux/math/infix.lux +++ /dev/null @@ -1,48 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] - [\\library - ["[0]" /]]) - -(def .public documentation - (List $.Documentation) - (list ($.module /._ - "") - - ($.definition /.infix - (format "Infix math syntax." - \n "The rules for infix syntax are simple." - \n "If you want your binary function to work well with it." - \n "Then take the argument to the right (y) as your first argument," - \n "and take the argument to the left (x) as your second argument.") - - ($.comment "Binary functions") - ($.example (infix [x * +10])) - ($.comment "=>") - ($.example (* +10 x)) - - ($.comment "Nested infix") - ($.example (infix [[x + y] * [x - y]])) - ($.comment "=>") - ($.example (* (- y x) (+ y x))) - - ($.comment "Unary functions") - ($.example (infix [sin [x + y]])) - ($.comment "=>") - ($.example (sin (+ y x))) - - ($.comment "Also works with logic") - ($.example (infix [[x < y] and [y < z]])) - ($.comment "=>") - ($.example (and (< z y) - (< y x))) - - ($.comment "Forms are left as-is") - ($.example (infix [(* 3 9) gcd 450])) - ($.comment "=>") - ($.example (gcd 450 (* 3 9)))) - )) diff --git a/stdlib/source/documentation/lux/math/modular.lux b/stdlib/source/documentation/lux/math/modular.lux deleted file mode 100644 index 64d76ae02..000000000 --- a/stdlib/source/documentation/lux/math/modular.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation] - [data - ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] - [\\library - ["[0]" /]]) - -(def .public documentation - (List $.Documentation) - (list ($.module /._ - "") - - ($.definition /.modulus) - ($.definition /.value) - ($.definition /.incorrect_modulus) - ($.definition /.codec) - - ($.definition /.=) - ($.definition /.<) - ($.definition /.<=) - ($.definition /.>) - ($.definition /.>=) - - ($.definition /.equivalence) - ($.definition /.order) - - ($.definition /.+) - ($.definition /.-) - ($.definition /.*) - - ($.definition /.addition) - ($.definition /.multiplication) - ($.definition /.inverse) - ($.definition /.moduli_are_not_equal) - - ($.definition (/.Mod %) - "A number under a modulus.") - - ($.definition /.modular - "" - ($.example (modular modulus value))) - - ($.definition /.adapter - "" - ($.example (adapter reference subject))) - )) diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux index f2a72fb32..85ecc6f4b 100644 --- a/stdlib/source/documentation/lux/meta.lux +++ b/stdlib/source/documentation/lux/meta.lux @@ -19,7 +19,7 @@ ["[1][0]" extension] ["[1][0]" target] ["[1][0]/" compiler - ["[1][0]" phase] + ... ["[1][0]" phase] [language [lux ["[1][0]" analysis] @@ -30,7 +30,7 @@ (def /compiler (List $.Documentation) (list.together - (list /compiler/phase.documentation + (list ... /compiler/phase.documentation /compiler/analysis.documentation /compiler/declaration.documentation /compiler/translation.documentation diff --git a/stdlib/source/documentation/lux/meta/compiler/language/lux/translation.lux b/stdlib/source/documentation/lux/meta/compiler/language/lux/translation.lux index f37babfcd..0b614941e 100644 --- a/stdlib/source/documentation/lux/meta/compiler/language/lux/translation.lux +++ b/stdlib/source/documentation/lux/meta/compiler/language/lux/translation.lux @@ -49,10 +49,6 @@ ($.definition /.save!) ($.definition /.learn) ($.definition /.learn_custom) - ($.definition /.learn_analyser) - ($.definition /.learn_synthesizer) - ($.definition /.learn_translator) - ($.definition /.learn_declaration) ($.definition /.unknown_definition) ($.definition /.remember) ($.definition /.no_context) diff --git a/stdlib/source/documentation/lux/meta/extension.lux b/stdlib/source/documentation/lux/meta/extension.lux index 3c81d0205..8e1faf319 100644 --- a/stdlib/source/documentation/lux/meta/extension.lux +++ b/stdlib/source/documentation/lux/meta/extension.lux @@ -14,10 +14,9 @@ [macro ["[0]" template]] [compiler - ["[0]" phase] [language [lux - [phase + ["[0]" phase (.only) ["[0]" declaration]]]]]]]] [\\library ["[0]" /]]) @@ -40,7 +39,7 @@ ($.definition /.translation "" ($.example (translation ("my translation" self phase archive [pass_through .any]) - (phase archive pass_through)))) + (phase archive pass_through)))) ($.definition /.declaration "" -- cgit v1.2.3