aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/function/mixin.lux
blob: 83ecbaac1014a86f6e4af6b13d895004e1698537 (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
(.using
  [library
   [lux {"-" if loop}
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]])

(documentation: (/.Mixin input output)
  "A partially-defined function which can be mixed with others to inherit their behavior.")

(documentation: /.fixed
  "Given a mixin, produces a normal function."
  [(fixed f)])

(documentation: /.nothing
  "A mixin that does nothing and just delegates work to the next mixin.")

(documentation: /.mixed
  "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent."
  [(mixed parent child)])

(documentation: /.advice
  "Only apply then mixin when the input meets some criterion."
  [(advice when then)])

(documentation: /.before
  "Executes an action before doing the main work."
  [(before monad action)])

(documentation: /.after
  "Executes an action after doing the main work."
  [(after monad action)])

(documentation: (/.Recursive input output)
  "An indirectly recursive function.")

(documentation: /.of_recursive
  "Transform an indirectly recursive function into a mixin."
  [(of_recursive recursive)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..Mixin
             ..fixed
             ..nothing
             ..mixed
             ..advice
             ..before
             ..after
             ..Recursive
             ..of_recursive
             ($.default /.monoid)]
            []))