1Prelude.compose(3kaya) Kaya module reference Prelude.compose(3kaya)
2
3
4
6 Prelude::compose - Compose two functions.
7
9 a(c) compose( a(b) f, b(c) g )
10
12 f The first function to compose
13
14 g The second function to compose
15
17 Compose two functions: compose(f,g)(x) == f(g(x))
18
19
20
21 Float double(Float x) {
22 return x*2.0;
23 }
24 Int roundDown(Float y) {
25 return Int(floor(y));
26 }
27 Void main() {
28 combined = compose(roundDown,double);
29 a = combined(3.6);
30 // a = 7
31 }
32
34 Kaya standard library by Edwin Brady, Chris Morris and others
35 (kaya@kayalang.org). For further information see http://kayalang.org/
36
38 The Kaya standard library is free software; you can redistribute it
39 and/or modify it under the terms of the GNU Lesser General Public
40 License (version 2.1 or any later version) as published by the Free
41 Software Foundation.
42
43
44
45Kaya December 2010 Prelude.compose(3kaya)