diff options
author | Eduardo Julian | 2015-05-14 08:23:10 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-05-14 08:23:10 -0400 |
commit | c4ac3e692ae96d6898d8efb42faf4dfadd43f4ae (patch) | |
tree | d6d33dd608fb73cb753d412f43efcfe70a97b22e /source/lux.lux | |
parent | 279598fd1d5aace000231e4e85e5f9967634ce81 (diff) |
- Removed the apparently unnecessary total-locals.
Diffstat (limited to '')
-rw-r--r-- | source/lux.lux | 46 |
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]) |