aboutsummaryrefslogtreecommitdiff
path: root/source/lux/codata/function.lux
diff options
context:
space:
mode:
authorEduardo Julian2015-07-31 20:33:29 -0400
committerEduardo Julian2015-07-31 20:33:29 -0400
commitc9e0b6c3a0c23b34cd6ffac1b93a266ae6243c4a (patch)
treefaf96e94ba0bf7dd762e2af05662fc24c8d90690 /source/lux/codata/function.lux
parent3b0b7de8d898662ba154aa8cbd578d26fb91e62e (diff)
- Did some refactoring of the standard library.
- Introduced 2 new modules: lux/data/tuple & lux/codata/function - Now doing safe reading of files. - Took the "let", "lambda" & "def" macros to their ultimate form. - Added some macros for doing better JVM interop. - Fixed a bug when compiling comparisons for doubles. - Changed the order in which arguments are compiled for all arithmetic operations, as the order is reversed (from the conventional order) in the JVM bytecode.
Diffstat (limited to 'source/lux/codata/function.lux')
-rw-r--r--source/lux/codata/function.lux26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/lux/codata/function.lux b/source/lux/codata/function.lux
new file mode 100644
index 000000000..3c40df188
--- /dev/null
+++ b/source/lux/codata/function.lux
@@ -0,0 +1,26 @@
+## Copyright (c) Eduardo Julian. All rights reserved.
+## The use and distribution terms for this software are covered by the
+## Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+## which can be found in the file epl-v10.html at the root of this distribution.
+## By using this software in any fashion, you are agreeing to be bound by
+## the terms of this license.
+## You must not remove this notice, or any other, from this software.
+
+(;import lux
+ (lux/control (monoid #as m)))
+
+## [Functions]
+(def #export (flip f)
+ (All [a b c]
+ (-> (-> a b c) (-> b a c)))
+ (lambda [y x] (f x y)))
+
+(def #export (. f g)
+ (All [a b c]
+ (-> (-> b c) (-> a b) (-> a c)))
+ (lambda [x] (f (g x))))
+
+## [Structures]
+(defstruct #export Comp/Monoid (All [a] (m;Monoid (-> a a)))
+ (def m;unit id)
+ (def m;++ .))