aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/collection/array.lux
blob: c4ce92a7a3aa671748adb50cbf357c52bc5cb366 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
(.require
 [library
  [lux (.except list)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]]
   [meta
    ["[0]" code]]]]
 [\\library
  ["[0]" /]])

(.def .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [($.default /.type_name)
             ($.default /.equivalence)
             ($.default /.monoid)
             ($.default /.functor)
             ($.default /.mix)
             ($.default /.every?)
             ($.default /.any?)

             ($.documentation (/.Array it)
               "Mutable arrays.")

             ($.documentation /.empty
               "An empty array of the specified size."
               [(empty size)])

             ($.documentation /.size
               ""
               [(size array)])

             ($.documentation /.item
               ""
               [(item index array)])

             ($.documentation /.has!
               "Mutate the array by writing a value to the specified index."
               [(has! index value array)])

             ($.documentation /.lacks!
               "Mutate the array by deleting the value at the specified index."
               [(lacks! index array)])

             ($.documentation /.has?
               ""
               [(has? index array)])

             ($.documentation /.revised!
               "Mutate the array by updating the value at the specified index."
               [(revised! index transform array)])

             ($.documentation /.upsert!
               (format "Mutate the array by updating the value at the specified index."
                       \n "If there is no value, update and write the default value given.")
               [(upsert! index default transform array)])

             ($.documentation /.copy!
               "Writes the contents of one array into the other."
               [(copy! length src_start src_array dest_start dest_array)])

             ($.documentation /.occupancy
               "Finds out how many cells in an array are occupied."
               [(occupancy array)])

             ($.documentation /.vacancy
               "Finds out how many cells in an array are vacant."
               [(vacancy array)])

             ($.documentation /.only!
               "Delete every item of the array that fails to satisfy the predicate."
               [(only! p xs)])

             ($.documentation /.example
               "Yields the first item in the array that satisfies the predicate."
               [(example p xs)])

             ($.documentation /.example'
               "Just like 'example', but with access to the index of each value."
               [(example' p xs)])

             ($.documentation /.clone
               "Yields a shallow clone of the array."
               [(clone xs)])

             ($.documentation /.of_list
               ""
               [(of_list xs)])

             ($.documentation /.list
               (format "Yields a list with every non-empty item in the array."
                       \n "Can use the optional default value when encountering an empty cell in the array.")
               [(list {.#None} array)
                (list {.#Some default} array)])]
            []))