(.using
  [library
   [lux "*"
    ["$" documentation {"+" documentation:}]
    [control
     ["<>" parser
      ["<[0]>" code]]]
    [data
     ["[0]" text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     [syntax {"+" syntax:}]
     ["[0]" code]
     ["[0]" template]]]]
  [\\library
   ["[0]" /]]
  ["[0]" / "_"
   ["[1][0]" ordered]
   ["[1][0]" plist]])

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

(documentation: /.empty
  "An empty dictionary."
  [(empty key_hash)])

(documentation: /.has
  ""
  [(has key val dict)])

(documentation: /.lacks
  ""
  [(lacks key dict)])

(documentation: /.value
  ""
  [(value key dict)])

(documentation: /.key?
  ""
  [(key? dict key)])

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

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

(documentation: /.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)])

(documentation: /.of_list
  ""
  [(of_list key_hash kvs)])

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

(documentation: /.merged_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.")
  [(merged_with f dict2 dict1)])

(documentation: /.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)])

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

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Dictionary
             ..empty
             ..has
             ..lacks
             ..value
             ..key?
             ..has'
             ..revised
             ..revised'
             ..of_list
             ..merged
             ..merged_with
             ..re_bound
             ..sub
             ($.default /.key_hash)
             ($.default /.key_already_exists)
             ($.default /.size)
             ($.default /.empty?)
             ($.default /.entries)
             ($.default /.keys)
             ($.default /.values)
             ($.default /.equivalence)
             ($.default /.functor)]
            [/ordered.documentation
             /plist.documentation]))
