From c4ac3e692ae96d6898d8efb42faf4dfadd43f4ae Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 14 May 2015 08:23:10 -0400 Subject: - Removed the apparently unnecessary total-locals. --- source/lux.lux | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'source/lux.lux') 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 [ ] -## (def ( pair) -## (All [a b] (-> (, a b) )) -## (case pair -## [f s] -## )) - -## [first f a] -## [second s b]) -- cgit v1.2.3