(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [collection
     ["[0]" list]]]]]
 [\\library
  ["[0]" /]])

(def math
  (.List $.Documentation)
  (list ($.definition /.cos)
        ($.definition /.sin)
        ($.definition /.tan)
        ($.definition /.acos)
        ($.definition /.asin)
        ($.definition /.atan)
        ($.definition /.exp)
        ($.definition /.log)
        ($.definition /.ceil)
        ($.definition /.floor)
        ($.definition /.root_2)
        ($.definition /.root_3)
        ($.definition /.round)
        ($.definition /.factorial)
        ($.definition /.hypotenuse)
        ($.definition /.sinh)
        ($.definition /.csch)
        ($.definition /.cosh)
        ($.definition /.sech)
        ($.definition /.tanh)
        ($.definition /.coth)
        ($.definition /.asinh)
        ($.definition /.acosh)
        ($.definition /.atanh)
        ($.definition /.acoth)
        ($.definition /.asech)
        ($.definition /.acsch)

        ($.definition /.e
          "The base of the natural logarithm.")

        ($.definition /.pi
          "The ratio of a circle's circumference to its diameter.")

        ($.definition /.tau
          "The ratio of a circle's circumference to its radius.")

        ($.definition /.pow
          ""
          [(pow param subject)])

        ($.definition /.atan_2
          ""
          [(atan_2 x y)])

        ($.definition /.log_by
          ""
          [(log_by base it)])
        ))

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

                    ($.definition /.positive?)
                    ($.definition /.negative?)
                    ($.definition /.zero?)
                    ($.definition /.opposite)
                    ($.definition /.abs)
                    ($.definition /.signum)
                    ($.definition /.nat)
                    ($.definition /.int)
                    ($.definition /.rev)
                    ($.definition /.equivalence)
                    ($.definition /.order)
                    ($.definition /.smallest)
                    ($.definition /.biggest)
                    ($.definition /.addition)
                    ($.definition /.multiplication)
                    ($.definition /.minimum)
                    ($.definition /.maximum)
                    ($.definition /.number?)
                    ($.definition /.decimal)
                    ($.definition /.bits)
                    ($.definition /.of_bits)
                    ($.definition /.binary)
                    ($.definition /.octal)
                    ($.definition /.hex)
                    ($.definition /.hash)

                    ($.definition /.=
                      "Frac(tion) equivalence."
                      [(= reference sample)])

                    ($.definition /.<
                      "Frac(tion) less-than."
                      [(< reference sample)])

                    ($.definition /.<=
                      "Frac(tion) less-than or equal."
                      [(<= reference sample)])

                    ($.definition /.>
                      "Frac(tion) greater-than."
                      [(> reference sample)])

                    ($.definition /.>=
                      "Frac(tion) greater-than or equal."
                      [(>= reference sample)])

                    (,, (with_template [<name> <doc>]
                          [($.definition <name>
                             <doc>)]

                          [/.+ "Frac(tion) addition."]
                          [/.- "Frac(tion) substraction."]
                          [/.* "Frac(tion) multiplication."]
                          [/./ "Frac(tion) division."]
                          [/.% "Frac(tion) remainder."]
                          ))

                    ($.definition /./%
                      ""
                      [(/% param subject)])

                    (,, (with_template [<name> <doc>]
                          [($.definition <name>
                             <doc>)]

                          [/.min "Frac(tion) minimum."]
                          [/.max "Frac(tion) minimum."]
                          ))

                    (,, (with_template [<name> <doc>]
                          [($.definition <name>
                             <doc>)]

                          [/.not_a_number "Not a number."]
                          [/.positive_infinity "Positive infinity."]
                          [/.negative_infinity "Negative infinity."]
                          ))

                    ($.definition /.not_a_number?
                      "Tests whether a frac is actually not-a-number."
                      [(not_a_number? it)])

                    ($.definition /.approximately?
                      ""
                      [(approximately? margin_of_error standard value)])

                    ($.definition /.mod
                      ""
                      [(mod divisor dividend)])

                    ..math
                    )))
