aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/control/function.lux
blob: 237844ab2941ca78feb49b37a0dabcf0b859732d (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
(.require
 [library
  [lux (.except if loop)
   ["$" documentation]
   [data
    [text (.only \n)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list (.use "[1]#[0]" monoid)]]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" contract]
  ["[1][0]" memo]
  ["[1][0]" mixin]
  ["[1][0]" mutual]
  ["[1][0]" predicate]])

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

                ($.definition /.monoid)

                ($.definition /.identity
                  (format "Identity function."
                          \n "Does nothing to its argument and just returns it.")
                  [(same? (identity value)
                          value)])

                ($.definition /.composite
                  "Function composition."
                  [(= ((composite f g) "foo")
                      (f (g "foo")))])

                ($.definition /.constant
                  "Create constant functions."
                  [(= ((constant "foo") "bar")
                      "foo")])

                ($.definition /.flipped
                  "Flips the order of the arguments of a function."
                  [(= ((flipped f) "foo" "bar")
                      (f "bar" "foo"))])

                ($.definition /.on
                  "Simple 1-argument function application."
                  [(on input function)])

                (all list#composite
                     /contract.documentation
                     /memo.documentation
                     /mixin.documentation
                     /mutual.documentation
                     /predicate.documentation)
                ))