aboutsummaryrefslogtreecommitdiff
path: root/source/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to 'source/lux.lux')
-rw-r--r--source/lux.lux46
1 files changed, 33 insertions, 13 deletions
diff --git a/source/lux.lux b/source/lux.lux
index 3b7bb9702..1385cf8a5 100644
--- a/source/lux.lux
+++ b/source/lux.lux
@@ -1876,7 +1876,7 @@
[Int:Ord Int _jvm_llt _jvm_lgt _jvm_leq]
[Real:Ord Real _jvm_dlt _jvm_dgt _jvm_deq])
-(defmacro #export (alias-lux tokens state)
+(defmacro #export (lux tokens state)
(case state
{#source source #modules modules #module-aliases module-aliases
#envs envs #types types #host host
@@ -2005,12 +2005,42 @@
_
(let [dummy ($symbol ["" ""])]
(#Right [state (list (` (_lux_case (~ struct)
- (~ dummy)
- (using (~ dummy) (~ body)))))])))
+ (~ dummy)
+ (using (~ dummy) (~ body)))))])))
_
(#Left "Wrong syntax for defsig")))
+(defmacro #export (when tokens)
+ (case tokens
+ (\ (list test body))
+ (return (list (` (if (~ test)
+ (#Some (~ body))
+ #None))))
+
+ _
+ (fail "Wrong syntax for when")))
+
+(def #export (flip f)
+ (All [a b c]
+ (-> (-> a b c) (-> b a c)))
+ (lambda [y x]
+ (f x y)))
+
+## (def #export (curry f)
+## (All [a b c]
+## (-> (-> (, a b) c)
+## (-> a b c)))
+## (lambda [x y]
+## (f [x y])))
+
+## (def #export (uncurry f)
+## (All [a b c]
+## (-> (-> a b c)
+## (-> (, a b) c)))
+## (lambda [[x y]]
+## (f x y)))
+
## (defmacro (loop tokens)
## (_lux_case tokens
## (#Cons [bindings (#Cons [body #Nil])])
@@ -2054,13 +2084,3 @@
## (` (lambda [func record]
## (set@' (~ tag) (func (get@' (~ tag) record)) record))))]
## (return (list output))))
-
-## (do-template [<name> <member> <type>]
-## (def (<name> pair)
-## (All [a b] (-> (, a b) <type>))
-## (case pair
-## [f s]
-## <member>))
-
-## [first f a]
-## [second s b])