(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]
   [math
    [number
     ["[0]" ratio]]]
   [meta
    [macro
     ["[0]" template]]]]]
 [\\library
  ["[0]" /]])

(`` (def .public documentation
      (List $.Documentation)
      (list ($.module /._
                      "")

            ($.definition /.Gram)
            ($.definition /.Meter)
            ($.definition /.Litre)
            ($.definition /.Second)
            ... ($.definition /.pure)
            ($.definition /.number)
            ($.definition /.equivalence)
            ($.definition /.order)
            ($.definition /.enum)
            ... ($.definition /.Kilo)
            ... ($.definition /.Mega)
            ... ($.definition /.Giga)
            ... ($.definition /.Milli)
            ... ($.definition /.Micro)
            ... ($.definition /.Nano)
            ($.definition /.+)
            ($.definition /.-)
            ($.definition /.*)
            ($.definition /./)

            ($.definition (/.Measure unit)
              "A quantity with an associated unit of measurement.")

            ($.definition (/.Unit unit)
              "A unit of measurement, to qualify numbers with.")

            ... ($.definition (/.Scale scale)
            ...   "A scale of magnitude.")

            ... ($.definition /.Pure
            ...   "A pure, unit-less measure.")

            ($.definition /.unit
              (format "Define a unit of measurement."
                      \n "Both the name of the type, and the name of the Unit implementation must be specified.")
              [(def feet (unit []))])

            ... ($.definition /.scale
            ...   "Define a scale of magnitude."
            ...   [(def bajillion (scale [1 1,234,567,890]))])

            ... ($.definition /.re_scaled
            ...   ""
            ...   [(re_scaled from to measure)])

            ... (,, (with_template [<type> <scale>]
            ...       [(`` ($.definition <scale>
            ...              (let [numerator (the [/.ratio ratio.#numerator] <scale>)
            ...                    denominator (the [/.ratio ratio.#denominator] <scale>)]
            ...                (format "The '" (,, (template.text [<scale>])) "' scale, from " (%.nat numerator) " to " (%.nat denominator) "."))))]

            ...       [/.Kilo /.kilo]
            ...       [/.Mega /.mega]
            ...       [/.Giga /.giga]

            ...       [/.Milli /.milli]
            ...       [/.Micro /.micro]
            ...       [/.Nano /.nano]
            ...       ))

            (,, (with_template [<unit>]
                  [(`` ($.definition <unit>
                         (format "The '" (,, (template.text [<unit>])) "' unit of meaurement.")))]

                  [/.gram]
                  [/.meter]
                  [/.litre]
                  [/.second]
                  ))
            )))
