aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/collection/tree.lux
blob: 35108c6c5d60af16216b727b9ca8ec8e35a939ad (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
(.require
 [library
  [lux (.except)
   ["$" documentation]
   [data
    ["[0]" text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list (.use "[1]#[0]" monoid)]]]]]
 ["[0]" \\parser]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" finger]
  ["[1][0]" zipper]])

(`` (def \\parser
      (List $.Documentation)
      (list ($.module \\parser._
                      "")

            ($.definition \\parser.cannot_move_further)

            ($.definition (\\parser.Parser it)
              "A parser of arbitrary trees.")

            ($.definition \\parser.result'
              "Applies the parser against a tree zipper."
              ($.example (result' parser zipper)))

            ($.definition \\parser.result
              "Applies the parser against a tree."
              ($.example (result parser tree)))

            ($.definition \\parser.value
              "Yields the value inside the current tree node.")

            (,, (with_template [<name> <doc>]
                  [($.definition <name>
                     <doc>)]

                  [\\parser.down "Move down."]
                  [\\parser.up "Move up."]

                  [\\parser.right "Move to the right."]
                  [\\parser.rightmost "Move to the rightmost node."]

                  [\\parser.left "Move to the left."]
                  [\\parser.leftmost "Move to the leftmost node."]
                  
                  [\\parser.next "Move to the next node."]
                  [\\parser.end "Move to the last node."]
                  
                  [\\parser.previous "Move to the previous node."]
                  [\\parser.start "Move to the root node."]
                  ))
            )))

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

                ($.definition /.equivalence)
                ($.definition /.functor)
                ($.definition /.mix)

                ($.definition (/.Tree it)
                  "A generic tree data-structure.")

                ($.definition /.flat
                  "All the leaf values of the tree, in order."
                  ($.example (flat tree)))

                ($.definition /.leaf
                  ""
                  ($.example (leaf value)))

                ($.definition /.branch
                  ""
                  ($.example (branch value children)))

                ($.definition /.tree
                  "Tree literals."
                  ($.example (is (Tree Nat)
                                 (tree 12
                                       {34 {}
                                           56 {}
                                           78 {90 {}}}))))

                (all list#composite
                     ..\\parser
                     /finger.documentation
                     /zipper.documentation
                     )
                ))