(.using
  [library
   [lux {"-" if loop}
    ["$" documentation {"+" documentation:}]
    [data
     [text {"+" \n}
      ["%" format {"+" format}]]]
    [macro
     ["[0]" template]]]]
  [\\library
   ["[0]" /]]
  ["[0]" / "_"
   ["[1][0]" contract]
   ["[1][0]" memo]
   ["[1][0]" mixin]
   ["[1][0]" mutual]])

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

(documentation: /.composite
  "Function composition."
  [(= ((composite f g) "foo")
      (f (g "foo")))])

(documentation: /.constant
  "Create constant functions."
  [(= ((constant "foo") "bar")
      "foo")])

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

(documentation: /.on
  "Simple 1-argument function application."
  [(on input function)])

(.def: .public documentation
  (.List $.Module)
  ($.module /._
            ""
            [..identity
             ..composite
             ..constant
             ..flipped
             ..on
             ($.default /.monoid)]
            [/contract.documentation
             /memo.documentation
             /mixin.documentation
             /mutual.documentation]))
