blob: 4f13be81365a4e00f990e3871e8c517cb0c3b068 (
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
|
## Copyright (c) Eduardo Julian. All rights reserved.
## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
## If a copy of the MPL was not distributed with this file,
## You can obtain one at http://mozilla.org/MPL/2.0/.
(;module:
lux
(lux (control monoid)))
## [Functions]
(def: #export (const c)
{#;doc "Create constant functions."}
(All [a b] (-> a (-> b a)))
(lambda [_] c))
(def: #export (flip f)
{#;doc "Flips the order of the arguments of a function."}
(All [a b c]
(-> (-> a b c) (-> b a c)))
(lambda [x y] (f y x)))
## [Structures]
(struct: #export Monoid<Function> (Monoid (All [a] (-> a a)))
(def: unit id)
(def: append .))
|