aboutsummaryrefslogtreecommitdiff
path: root/source/lux/meta/lux.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/meta/lux.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/meta/lux.lux')
-rw-r--r--source/lux/meta/lux.lux42
1 files changed, 24 insertions, 18 deletions
diff --git a/source/lux/meta/lux.lux b/source/lux/meta/lux.lux
index 19b7dd9df..13dcae284 100644
--- a/source/lux/meta/lux.lux
+++ b/source/lux/meta/lux.lux
@@ -10,12 +10,11 @@
(.. macro)
(lux/control (monoid #as m)
(functor #as F)
- (monad #as M #refer (#only do)))
+ (monad #as M #refer (#only do))
+ (show #as S))
(lux/data list
- maybe
- (show #as S)
- (number #as N)
- (text #as T #open ("text:" Text/Monoid Text/Eq))))
+ (text #as T #open ("text:" Text/Monoid Text/Eq))
+ (number/int #as I #open ("i" Int/Number))))
## [Types]
## (deftype (Lux a)
@@ -77,20 +76,27 @@
(def (find-macro' modules current-module module name)
(-> (List (, Text (Module Compiler))) Text Text Text
(Maybe Macro))
- (do Maybe/Monad
- [$module (get module modules)
- gdef (|> (: (Module Compiler) $module) (get@ #;defs) (get name))]
- (case (: (, Bool (DefData' Macro)) gdef)
- [exported? (#;MacroD macro')]
- (if (or exported? (text:= module current-module))
- (#;Some macro')
+ (case (get module modules)
+ (#;Some $module)
+ (case (|> (: (Module Compiler) $module) (get@ #;defs) (get name))
+ (#;Some gdef)
+ (case (: (, Bool (DefData' Macro)) gdef)
+ [exported? (#;MacroD macro')]
+ (if (or exported? (text:= module current-module))
+ (#;Some macro')
+ #;None)
+
+ [_ (#;AliasD [r-module r-name])]
+ (find-macro' modules current-module r-module r-name)
+
+ _
#;None)
-
- [_ (#;AliasD [r-module r-name])]
- (find-macro' modules current-module r-module r-name)
_
- #;None)))
+ #;None)
+
+ _
+ #;None))
(def #export (find-macro ident)
(-> Ident (Lux (Maybe Macro)))
@@ -147,8 +153,8 @@
(def #export (gensym prefix state)
(-> Text (Lux Syntax))
- (#;Right [(update@ #;seed inc state)
- (symbol$ ["__gensym__" (:: N;Int/Show (S;show (get@ #;seed state)))])]))
+ (#;Right [(update@ #;seed (i+ 1) state)
+ (symbol$ ["__gensym__" (:: I;Int/Show (S;show (get@ #;seed state)))])]))
(def #export (emit datum)
(All [a]