(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]])

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

        ($.definition (/.Object brand))
        ($.definition /.Function)
        ($.definition /.Symbol)
        ($.definition /.Null)
        ($.definition /.Undefined)
        ($.definition /.Boolean)
        ($.definition /.Number)
        ($.definition /.String)
        ($.definition /.null?)
        ($.definition /.on_browser?)
        ($.definition /.on_nashorn?)
        ($.definition /.on_node_js?)

        ($.definition /.null
          "The null pointer.")

        ($.definition /.import
          "Easily import types, methods, functions and constants."
          [(import Uint8Array
             "[1]::[0]")

           (import TextEncoder
             "[1]::[0]"
             (new [/.String])
             (encode [/.String] Uint8Array))

           (import TextDecoder
             "[1]::[0]"
             (new [/.String])
             (decode [/.String] String))])

        ($.definition /.type_of
          "The type of an object, as text."
          [(= "boolean"
              (type_of true))]
          [(= "number"
              (type_of +123.456))]
          [(= "string"
              (type_of "789"))]
          [(= "function"
              (type_of (function (_ value) value)))])

        ($.definition /.global
          "Allows using definitions from the JavaScript host platform."
          [(global .Frac [Math PI])])

        ($.definition /.function
          (format "Allows defining closures/anonymous-functions in the form that JavaScript expects."
                  \n "This is useful for adapting Lux functions for usage by JavaScript code.")
          [(is /.Function
               (function [left right]
                 (do_something (as Foo left) (as Bar right))))])
        ))
