aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/collection/dictionary.lux
blob: 99f6342b409536dc423cedb985da8b645ed79275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" ordered]])

(.def .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [($.default /.key_hash)
             ($.default /.key_already_exists)
             ($.default /.size)
             ($.default /.empty?)
             ($.default /.entries)
             ($.default /.keys)
             ($.default /.values)
             ($.default /.equivalence)
             ($.default /.functor)

             ($.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 /.composite
               (format "Merges 2 dictionaries."
                       \n "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")
               [(composite dict2 dict1)])

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

             ($.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)])]
            [/ordered.documentation]))