aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/lux.lux46
-rw-r--r--source/program.lux2
2 files changed, 34 insertions, 14 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])
diff --git a/source/program.lux b/source/program.lux
index 20f7863ab..a9451580f 100644
--- a/source/program.lux
+++ b/source/program.lux
@@ -1,4 +1,4 @@
-(;alias-lux)
+(;lux)
(def (filter p xs)
(All [a] (-> (-> a Bool) (List a) (List a)))