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

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

                ($.definition /.key_hash)
                ($.definition /.key_already_exists)
                ($.definition /.size)
                ($.definition /.empty?)
                ($.definition /.entries)
                ($.definition /.keys)
                ($.definition /.values)
                ($.definition /.equivalence)
                ($.definition /.functor)

                ($.definition (/.Dictionary key value)
                  "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).")

                ($.definition /.empty
                  "An empty dictionary."
                  [(empty key_hash)])

                ($.definition /.has
                  ""
                  [(has key val dict)])

                ($.definition /.lacks
                  ""
                  [(lacks key dict)])

                ($.definition /.value
                  ""
                  [(value key dict)])

                ($.definition /.key?
                  ""
                  [(key? dict key)])

                ($.definition /.has'
                  "Only puts the KV-pair if the key is not already present."
                  [(has' key val dict)])

                ($.definition /.revised
                  "Transforms the value located at key (if available), using the given function."
                  [(revised key f dict)])

                ($.definition /.revised'
                  (format "Updates the value at the key; if it exists."
                          \n "Otherwise, puts a value by applying the function to a default.")
                  [(revised' key default f dict)])

                ($.definition /.of_list
                  ""
                  [(of_list key_hash kvs)])

                ($.definition /.composite
                  (format "Merges 2 dictionaries."
                          \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")
                  [(composite dict2 dict1)])

                ($.definition /.composite_with
                  (format "Merges 2 dictionaries."
                          \n "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")
                  [(composite_with f dict2 dict1)])

                ($.definition /.re_bound
                  "If there is a value under 'from_key', remove 'from_key' and store the value under 'to_key'."
                  [(re_bound from_key to_key dict)])

                ($.definition /.sub
                  "A sub-dictionary, with only the specified keys."
                  [(sub keys dict)])

                /ordered.documentation
                ))
