From 6031fc715b4a16b008d6f288c38739d9bb066490 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 26 Nov 2017 22:52:18 -0400 Subject: - Changed to the new relative imports syntax. --- new-luxc/source/luxc/lang/analysis/expression.lux | 2 +- new-luxc/source/luxc/lang/analysis/procedure.lux | 10 +- .../luxc/lang/analysis/procedure/host.jvm.lux | 2 +- new-luxc/source/luxc/lang/host/jvm/def.lux | 4 +- new-luxc/source/luxc/lang/host/jvm/inst.lux | 4 +- new-luxc/source/luxc/lang/host/jvm/type.lux | 12 +- new-luxc/source/luxc/lang/translation/case.jvm.lux | 24 +-- .../source/luxc/lang/translation/primitive.jvm.lux | 3 +- .../source/luxc/lang/translation/procedure.jvm.lux | 10 +- .../luxc/lang/translation/procedure/host.jvm.lux | 2 +- .../source/luxc/lang/translation/structure.jvm.lux | 3 +- stdlib/source/lux.lux | 206 +++++++++++---------- stdlib/source/lux/concurrency/actor.lux | 2 +- stdlib/source/lux/concurrency/frp.lux | 2 +- stdlib/source/lux/control/applicative.lux | 2 +- stdlib/source/lux/control/comonad.lux | 2 +- stdlib/source/lux/control/hash.lux | 2 +- stdlib/source/lux/control/monad.lux | 2 +- stdlib/source/lux/control/order.lux | 2 +- stdlib/source/lux/data/coll/tree/parser.lux | 2 +- stdlib/source/lux/macro.lux | 2 +- stdlib/source/lux/macro/poly/json.lux | 76 ++++---- stdlib/source/lux/macro/syntax.lux | 2 +- stdlib/source/lux/macro/syntax/common/reader.lux | 14 +- stdlib/source/lux/macro/syntax/common/writer.lux | 6 +- stdlib/source/lux/math/logic/fuzzy.lux | 2 +- stdlib/source/lux/time/instant.lux | 2 +- stdlib/source/lux/world/net/tcp.jvm.lux | 6 +- stdlib/source/lux/world/net/udp.jvm.lux | 10 +- stdlib/test/test/lux/cli.lux | 20 +- stdlib/test/test/lux/time/instant.lux | 2 +- stdlib/test/test/lux/world/file.lux | 2 +- stdlib/test/test/lux/world/net/tcp.lux | 2 +- stdlib/test/test/lux/world/net/udp.lux | 2 +- 34 files changed, 223 insertions(+), 223 deletions(-) diff --git a/new-luxc/source/luxc/lang/analysis/expression.lux b/new-luxc/source/luxc/lang/analysis/expression.lux index 6abe8e62b..b16499c01 100644 --- a/new-luxc/source/luxc/lang/analysis/expression.lux +++ b/new-luxc/source/luxc/lang/analysis/expression.lux @@ -15,7 +15,7 @@ [";L" macro] ["la" analysis] (translation [";T" common]))) - (.. [";A" common] + (// [";A" common] [";A" function] [";A" primitive] [";A" reference] diff --git a/new-luxc/source/luxc/lang/analysis/procedure.lux b/new-luxc/source/luxc/lang/analysis/procedure.lux index 23e1a102d..4e9843ddd 100644 --- a/new-luxc/source/luxc/lang/analysis/procedure.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure.lux @@ -8,15 +8,15 @@ (coll [dict]))) (luxc ["&" lang] (lang ["la" analysis])) - (. ["./;" common] - ["./;" host])) + (/ ["/;" common] + ["/;" host])) (exception: #export Unknown-Procedure) (def: procedures - ./common;Bundle - (|> ./common;procedures - (dict;merge ./host;procedures))) + /common;Bundle + (|> /common;procedures + (dict;merge /host;procedures))) (def: #export (analyse-procedure analyse eval proc-name proc-args) (-> &;Analyser &;Eval Text (List Code) (Meta la;Analysis)) diff --git a/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux index fad31eca0..bb388434f 100644 --- a/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux @@ -25,7 +25,7 @@ ["la" analysis] (analysis ["&;" common] [";A" inference]))) - ["@" ../common] + ["@" //common] ) (exception: #export Wrong-Syntax) diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index 60009fb5c..ec1de6b43 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -6,8 +6,8 @@ (coll ["a" array] [list "list/" Functor])) [host #+ do-to]) - ["$" ..] - (.. ["$t" type])) + ["$" //] + (// ["$t" type])) ## [Host] (host;import #long java.lang.Object) diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index dc2909b69..e0c10feca 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -10,8 +10,8 @@ [macro] (macro [code] ["s" syntax #+ syntax:])) - ["$" ..] - (.. ["$t" type])) + ["$" //] + (// ["$t" type])) ## [Host] (host;import #long java.lang.Object) diff --git a/new-luxc/source/luxc/lang/host/jvm/type.lux b/new-luxc/source/luxc/lang/host/jvm/type.lux index 3825d443b..03246540c 100644 --- a/new-luxc/source/luxc/lang/host/jvm/type.lux +++ b/new-luxc/source/luxc/lang/host/jvm/type.lux @@ -2,8 +2,8 @@ [lux #- char] (lux (data [text] text/format - (coll [list "L/" Functor]))) - ["$" ..]) + (coll [list "list/" Functor]))) + ["$" //]) ## Types (do-template [ ] @@ -91,7 +91,7 @@ "" (format "<" (|> params - (L/map (|>. #$;Generic signature)) + (list/map (|>. #$;Generic signature)) (text;join-with "")) ">"))] (format "L" (binary-name class) =params ";")) @@ -116,7 +116,7 @@ (def: #export (method-descriptor method) (-> $;Method Text) - (format "(" (text;join-with "" (L/map descriptor (get@ #$;args method))) ")" + (format "(" (text;join-with "" (list/map descriptor (get@ #$;args method))) ")" (case (get@ #$;return method) #;None "V" @@ -126,7 +126,7 @@ (def: #export (method-signature method) (-> $;Method Text) - (format "(" (|> (get@ #$;args method) (L/map signature) (text;join-with "")) ")" + (format "(" (|> (get@ #$;args method) (list/map signature) (text;join-with "")) ")" (case (get@ #$;return method) #;None "V" @@ -134,5 +134,5 @@ (#;Some return) (signature return)) (|> (get@ #$;exceptions method) - (L/map (|>. #$;Generic signature (format "^"))) + (list/map (|>. #$;Generic signature (format "^"))) (text;join-with "")))) diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux index cf2cdb7f1..3363e007c 100644 --- a/new-luxc/source/luxc/lang/translation/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux @@ -10,7 +10,7 @@ (jvm ["$t" type] ["$i" inst])) ["ls" synthesis])) - [../runtime]) + [//runtime]) (def: $Object $;Type ($t;class "java.lang.Object" (list))) @@ -29,7 +29,7 @@ (|>. $i;DUP ($i;INVOKESTATIC hostL;runtime-class "pm_peek" - ($t;method (list ../runtime;$Stack) + ($t;method (list //runtime;$Stack) (#;Some $Object) (list)) false))) @@ -38,8 +38,8 @@ $;Inst (|>. ($i;INVOKESTATIC hostL;runtime-class "pm_pop" - ($t;method (list ../runtime;$Stack) - (#;Some ../runtime;$Stack) + ($t;method (list //runtime;$Stack) + (#;Some //runtime;$Stack) (list)) false))) @@ -47,8 +47,8 @@ $;Inst (|>. ($i;INVOKESTATIC hostL;runtime-class "pm_push" - ($t;method (list ../runtime;$Stack $Object) - (#;Some ../runtime;$Stack) + ($t;method (list //runtime;$Stack $Object) + (#;Some //runtime;$Stack) (list)) false))) @@ -112,18 +112,18 @@ (macro/wrap (case idx +0 (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;CHECKCAST ($t;descriptor //runtime;$Tuple)) ($i;int 0) $i;AALOAD pushI) _ (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;CHECKCAST ($t;descriptor //runtime;$Tuple)) ($i;int (nat-to-int idx)) ($i;INVOKESTATIC hostL;runtime-class - ($t;method (list ../runtime;$Tuple $t;int) + ($t;method (list //runtime;$Tuple $t;int) (#;Some $Object) (list)) false) @@ -136,12 +136,12 @@ (macro/wrap (<| $i;with-label (function [@success]) $i;with-label (function [@fail]) (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Variant)) + ($i;CHECKCAST ($t;descriptor //runtime;$Variant)) ($i;int (nat-to-int idx)) ($i;INVOKESTATIC hostL;runtime-class "pm_variant" - ($t;method (list ../runtime;$Variant ../runtime;$Tag ../runtime;$Flag) - (#;Some ../runtime;$Datum) + ($t;method (list //runtime;$Variant //runtime;$Tag //runtime;$Flag) + (#;Some //runtime;$Datum) (list)) false) $i;DUP diff --git a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux index e8522ebfc..acd3b95e3 100644 --- a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux @@ -10,8 +10,7 @@ ["$t" type])) ["la" analysis] ["ls" synthesis] - (translation [";T" common]))) - [../runtime]) + (translation [";T" common])))) (def: #export translate-unit (Meta $;Inst) diff --git a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux index 917edd78d..14fbe2f1a 100644 --- a/new-luxc/source/luxc/lang/translation/procedure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure.jvm.lux @@ -8,15 +8,15 @@ (luxc ["&" lang] (lang (host ["$" jvm]) ["ls" synthesis])) - (. ["./;" common] - ["./;" host])) + (/ ["/;" common] + ["/;" host])) (exception: #export Unknown-Procedure) (def: procedures - ./common;Bundle - (|> ./common;procedures - (dict;merge ./host;procedures))) + /common;Bundle + (|> /common;procedures + (dict;merge /host;procedures))) (def: #export (translate-procedure translate name args) (-> (-> ls;Synthesis (Meta $;Inst)) Text (List ls;Synthesis) diff --git a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux index b020fed7b..2aa693d2c 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux @@ -23,7 +23,7 @@ ["la" analysis] (analysis (procedure ["&;" host])) ["ls" synthesis])) - ["@" ../common]) + ["@" //common]) (exception: #export Invalid-Syntax-For-JVM-Type) (exception: #export Invalid-Syntax-For-Argument-Generation) diff --git a/new-luxc/source/luxc/lang/translation/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/structure.jvm.lux index 21d72b34b..ddb48a31e 100644 --- a/new-luxc/source/luxc/lang/translation/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/structure.jvm.lux @@ -14,8 +14,7 @@ ["$i" inst])) ["la" analysis] ["ls" synthesis] - (translation [";T" common]))) - [../runtime]) + (translation [";T" common])))) (exception: #export Not-A-Tuple) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 0dcc335a0..5521e2d0d 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1205,7 +1205,7 @@ (#Cons x xs') (list/fold f (f x init) xs')})) -(def:'' (length list) +(def:'' (list/size list) #;Nil (#UnivQ #Nil (#Function ($' List (#Bound +1)) Nat)) @@ -1250,7 +1250,7 @@ [false _] (replace-syntax (#Cons [self-name (make-bound ("lux nat *" +2 ("lux nat -" - (length names) + (list/size names) +1)))] #Nil) body')}) @@ -1301,7 +1301,7 @@ [false _] (replace-syntax (#Cons [self-name (make-bound ("lux nat *" +2 ("lux nat -" - (length names) + (list/size names) +1)))] #Nil) body')}) @@ -1311,7 +1311,7 @@ (fail "Wrong syntax for Ex")}) )) -(def:'' (reverse list) +(def:'' (list/reverse list) #;Nil (All [a] (#Function ($' List a) ($' List a))) (list/fold ("lux check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) @@ -1326,7 +1326,7 @@ ## This is the type of a function that takes 2 Ints and returns an Int.")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons output inputs) (return (#Cons (list/fold ("lux check" (#Function Code (#Function Code Code)) (function'' [i o] (form$ (#Cons (tag$ ["lux" "Function"]) (#Cons i (#Cons o #Nil)))))) @@ -1347,7 +1347,7 @@ (#Cons (tuple$ (#Cons [head (#Cons [tail #Nil])])) #Nil)))) (tag$ ["lux" "Nil"]) - (reverse xs)) + (list/reverse xs)) #Nil))) (macro:' #export (list& xs) @@ -1356,7 +1356,7 @@ ## In other words, this macro prepends elements to another list. (list& 1 2 3 (list 4 5 6))")] #;Nil) - ("lux case" (reverse xs) + ("lux case" (list/reverse xs) {(#Cons last init) (return (list (list/fold (function'' [head tail] (form$ (list (tag$ ["lux" "Cons"]) @@ -1375,7 +1375,7 @@ ## The empty tuple, a.k.a. Unit. (&)")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {#Nil (return (list (tag$ ["lux" "Unit"]))) @@ -1393,7 +1393,7 @@ ## The empty tuple, a.k.a. Void. (|)")] #;Nil) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {#Nil (return (list (tag$ ["lux" "Void"]))) @@ -1426,7 +1426,7 @@ arg body'))) body - (reverse targs))))))}) + (list/reverse targs))))))}) _ (fail "Wrong syntax for function'")}))) @@ -1504,7 +1504,7 @@ {[label value] (form$ (list (text$ "lux case") value (record$ (list [label body]))))}))) body - (reverse (as-pairs bindings))))) + (list/reverse (as-pairs bindings))))) _ (fail "Wrong syntax for let'")})) @@ -1600,7 +1600,7 @@ #;Nil) ("lux case" tokens {(#Cons op tokens') - ("lux case" (reverse tokens') + ("lux case" (list/reverse tokens') {(#Cons last prevs) (return (list (list/fold (_$_joiner op) last prevs))) @@ -1674,7 +1674,7 @@ (form$ (list (text$ "lux function") (symbol$ ["" ""]) var body')) value))})))) body - (reverse (as-pairs bindings)))] + (list/reverse (as-pairs bindings)))] (return (list (form$ (list (text$ "lux case") monad (record$ (list [(record$ (list [(tag$ ["lux" "wrap"]) g!wrap] [(tag$ ["lux" "bind"]) g!bind])) @@ -1847,7 +1847,7 @@ (-> Bool (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ("lux case" replace? {true - ("lux case" (reverse elems) + ("lux case" (list/reverse elems) {#Nil (return (tag$ ["lux" "Nil"])) @@ -2082,7 +2082,7 @@ (fold text/compose \"\" (interpose \" \" (map int/encode elems)))")]) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons [init apps]) (return (list (list/fold ("lux check" (-> Code Code Code) (function' [app acc] @@ -2210,9 +2210,9 @@ {[(#Some bindings') (#Some data')] (let' [apply ("lux check" (-> RepEnv ($' List Code)) (function' [env] (map (apply-template env) templates))) - num-bindings (length bindings')] + num-bindings (list/size bindings')] (if (every? (function' [sample] ("lux nat =" num-bindings sample)) - (map length data')) + (map list/size data')) (|> data' (join-map (. apply (make-env bindings'))) return) @@ -2480,7 +2480,7 @@ #Nil (All [a] (-> ($' List ($' List a)) ($' List a))) - (list/fold list/compose #Nil (reverse xs))) + (list/fold list/compose #Nil (list/reverse xs))) (def:''' (interpose sep xs) #Nil @@ -2752,7 +2752,7 @@ (log! \"#2\") (log! \"#3\") \"YOLO\")")]) - ("lux case" (reverse tokens) + ("lux case" (list/reverse tokens) {(#Cons value actions) (let' [dummy (symbol$ ["" ""])] (return (list (list/fold ("lux check" (-> Code Code Code) @@ -2849,21 +2849,21 @@ ($_ text/compose "(" (|> xs (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) ")") [_ (#Tuple xs)] ($_ text/compose "[" (|> xs (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) "]") [_ (#Record kvs)] ($_ text/compose "{" (|> kvs (map (function' [kv] ("lux case" kv {[k v] ($_ text/compose (code-to-text k) " " (code-to-text v))}))) (interpose " ") - reverse + list/reverse (list/fold text/compose "")) "}")} )) @@ -2897,7 +2897,7 @@ (fail ($_ text/compose "\"lux;case\" expects an even number of tokens: " (|> branches (map code-to-text) (interpose " ") - reverse + list/reverse (list/fold text/compose ""))))})) (macro:' #export (case tokens) @@ -2996,8 +2996,8 @@ (op x y))")]) (case tokens (^ (list [_ (#Tuple bindings)] body)) - (if (multiple? +2 (length bindings)) - (|> bindings as-pairs reverse + (if (multiple? +2 (list/size bindings)) + (|> bindings as-pairs list/reverse (list/fold (: (-> [Code Code] Code Code) (function' [lr body'] (let' [[l r] lr] @@ -3041,7 +3041,7 @@ (` ("lux function" (~ g!blank) (~ g!blank) (case (~ g!blank) (~ arg) (~ body'))))))) body - (reverse tail))] + (list/reverse tail))] (return (list (if (symbol? head) (` ("lux function" (~ g!name) (~ head) (~ body+))) (` ("lux function" (~ g!name) (~ g!blank) (case (~ g!blank) (~ head) (~ body+)))))))) @@ -3373,7 +3373,7 @@ (do-template [
] [(macro: #export ( tokens) {#;doc } - (case (reverse tokens) + (case (list/reverse tokens) (^ (list& last init)) (return (list (list/fold (: (-> Code Code Code) (function [pre post] (` ))) @@ -3442,41 +3442,19 @@ _ (#;Left "Wrong syntax for default"))) -(def: (split-text splitter input) +(def: (text/split splitter input) (-> Text Text (List Text)) (case (index-of splitter input) #;None - (#Cons input #Nil) + (list input) (#;Some idx) - (#Cons (default (error! "UNDEFINED") + (list& (default (error! "UNDEFINED") (clip2 +0 idx input)) - (split-text splitter + (text/split splitter (default (error! "UNDEFINED") (clip1 (n.+ +1 idx) input)))))) -(def: (split-module-contexts module) - (-> Text (List Text)) - (#Cons module (case (last-index-of "/" module) - #;None - #Nil - - (#;Some idx) - (split-module-contexts (default (error! "UNDEFINED") - (clip2 +0 idx module)))))) - -(def: (split-module module) - (-> Text (List Text)) - (case (index-of "/" module) - #;None - (list module) - - (#;Some idx) - (list& (default (error! "UNDEFINED") - (clip2 +0 idx module)) - (split-module (default (error! "UNDEFINED") - (clip1 (n.+ +1 idx) module)))))) - (def: (nth idx xs) (All [a] (-> Nat (List a) (Maybe a))) @@ -3719,7 +3697,7 @@ (def: (text/join parts) (-> (List Text) Text) - (|> parts reverse (list/fold text/compose ""))) + (|> parts list/reverse (list/fold text/compose ""))) (macro: #export (struct: tokens) {#;doc "## Definition of structures ala ML. @@ -3969,7 +3947,7 @@ (All [a] (-> (-> a Bool) (List a) [(List a) (List a)])) (let [[ys' xs'] (split-with' p #Nil xs)] - [(reverse ys') xs'])) + [(list/reverse ys') xs'])) (def: (parse-short-referrals tokens) (-> (List Code) (Meta [Referrals (List Code)])) @@ -4089,30 +4067,53 @@ (-> Text Text Text Text) ("lux text replace-all" template pattern value)) -(def: (clean-module module) - (-> Text (Meta Text)) - (do Monad - [current-module current-module-name] - (case (split-module module) - (^ (list& "." parts)) - (return (|> (list& current-module parts) (interpose "/") reverse (list/fold text/compose ""))) - - parts - (let [[ups parts'] (split-with (text/= "..") parts) - num-ups (length ups)] - (if (n.= +0 num-ups) - (return module) - (case (nth num-ups (split-module-contexts current-module)) - #None - (fail (text/compose "Cannot clean module: " module)) - - (#Some top-module) - (return (|> (list& top-module parts') (interpose "/") reverse (list/fold text/compose "")))) - ))) - )) - -(def: (parse-imports imports) - (-> (List Code) (Meta (List Importation))) +(def: (count-ups ups input) + (-> Nat Text Nat) + (case ("lux text index" input "/" ups) + #;None + ups + + (#;Some found) + (if (n.= ups found) + (count-ups (n.+ +1 ups) input) + ups))) + +(def: (list/drop amount a+) + (All [a] (-> Nat (List a) (List a))) + (case [amount a+] + (^or [+0 _] [_ #;Nil]) + a+ + + [_ (#;Cons _ a+')] + (list/drop (n.- +1 amount) a+'))) + +(def: (clean-module relative-root module) + (-> Text Text (Meta Text)) + (case (count-ups +0 module) + +0 + (return module) + + ups + (let [parts (text/split "/" relative-root)] + (if (n.< (list/size parts) (n.- +1 ups)) + (let [prefix (|> parts + list/reverse + (list/drop (n.- +1 ups)) + list/reverse + (interpose "/") + text/join) + clean (|> module (clip1 ups) (default (error! "UNDEFINED"))) + output (case ("lux text size" clean) + +0 prefix + _ ($_ text/compose prefix "/" clean))] + (return output)) + (fail ($_ text/compose + "Cannot climb the module hierarchy...\n" + "Importing module: " module "\n" + " Relative Root: " relative-root "\n")))))) + +(def: (parse-imports relative-root imports) + (-> Text (List Code) (Meta (List Importation))) (do Monad [imports' (monad/map Monad (: (-> Code (Meta (List Importation))) @@ -4120,20 +4121,20 @@ (case token [_ (#Symbol "" m-name)] (do Monad - [m-name (clean-module m-name)] + [m-name (clean-module relative-root m-name)] (wrap (list [m-name #None {#refer-defs #All #refer-open (list)}]))) (^ [_ (#Form (list& [_ (#Symbol "" m-name)] extra))]) (do Monad - [m-name (clean-module m-name) + [m-name (clean-module relative-root m-name) alias+extra (parse-alias extra) #let [[alias extra] alias+extra] referral+extra (parse-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-openings extra) #let [[openings extra] openings+extra] - sub-imports (parse-imports extra) + sub-imports (parse-imports relative-root extra) #let [sub-imports (decorate-sub-importations m-name sub-imports)]] (wrap (case [referral alias openings] [#Nothing #None #Nil] sub-imports @@ -4145,7 +4146,7 @@ (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol "" m-name)] extra))]) (do Monad - [m-name (clean-module m-name) + [m-name (clean-module relative-root m-name) referral+extra (parse-short-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-short-openings extra) @@ -4157,7 +4158,7 @@ (^ [_ (#Tuple (list& [_ (#Symbol "" raw-m-name)] extra))]) (do Monad - [m-name (clean-module raw-m-name) + [m-name (clean-module relative-root raw-m-name) referral+extra (parse-short-referrals extra) #let [[referral extra] referral+extra] openings+extra (parse-short-openings extra) @@ -4366,7 +4367,7 @@ name _ - ($_ text/compose "(" name " " (|> params (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")")) + ($_ text/compose "(" name " " (|> params (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")")) #Void "Void" @@ -4375,13 +4376,13 @@ "Unit" (#Sum _) - ($_ text/compose "(| " (|> (flatten-variant type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")") + ($_ text/compose "(| " (|> (flatten-variant type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")") (#Product _) - ($_ text/compose "[" (|> (flatten-tuple type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) "]") + ($_ text/compose "[" (|> (flatten-tuple type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) "]") (#Function _) - ($_ text/compose "(-> " (|> (flatten-lambda type) (map type/show) (interpose " ") reverse (list/fold text/compose "")) ")") + ($_ text/compose "(-> " (|> (flatten-lambda type) (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")") (#Bound id) (nat/encode id) @@ -4402,7 +4403,7 @@ (let [[func args] (flatten-app type)] ($_ text/compose "(" (type/show func) " " - (|> args (map type/show) (interpose " ") reverse (list/fold text/compose "")) + (|> args (map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")")) (#Named [prefix name] _) @@ -4473,9 +4474,9 @@ (n.odd? num) \"odd\" ## else-branch \"???\")"} - (if (n.= +0 (n.% +2 (length tokens))) + (if (n.= +0 (n.% +2 (list/size tokens))) (fail "cond requires an even number of arguments.") - (case (reverse tokens) + (case (list/reverse tokens) (^ (list& else branches')) (return (list (list/fold (: (-> [Code Code] Code Code) (function [branch else] @@ -4758,7 +4759,7 @@ (ident #open (\"ident/\" Codec))) meta (macro code)) - (.. (type #open (\"\" Eq)))) + (// (type #open (\"\" Eq)))) (;module: {#;doc \"Some documentation...\"} lux @@ -4769,7 +4770,7 @@ [ident \"ident/\" Codec]) meta (macro code)) - (.. [type \"\" Eq]))"} + (// [type \"\" Eq]))"} (do Monad [#let [[_meta _imports] (: [(List [Code Code]) (List Code)] (case tokens @@ -4778,7 +4779,8 @@ _ [(list) tokens]))] - imports (parse-imports _imports) + current-module current-module-name + imports (parse-imports current-module _imports) #let [=imports (map (: (-> Importation Code) (function [[m-name m-alias =refer]] (` [(~ (text$ m-name)) (~ (text$ (default "" m-alias)))]))) @@ -4870,14 +4872,14 @@ (function [[s b] v] (` (;;set@ (~ s) (~ v) (~ b))))) value - (reverse pairs)) + (list/reverse pairs)) [_ accesses'] (list/fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function [[new-slot new-binding] [old-record accesses']] [(` (get@ (~ new-slot) (~ new-binding))) (#;Cons (list new-binding old-record) accesses')])) [record (: (List (List Code)) #;Nil)] pairs) - accesses (list/join (reverse accesses'))]] + accesses (list/join (list/reverse accesses'))]] (wrap (list (` (let [(~@ accesses)] (~ update-expr))))))) @@ -5011,7 +5013,7 @@ (do Monad [bindings' (monad/map Monad get-name bindings) data' (monad/map Monad tuple->list data)] - (if (every? (n.= (length bindings')) (map length data')) + (if (every? (n.= (list/size bindings')) (map list/size data')) (let [apply (: (-> RepEnv (List Code)) (function [env] (map (apply-template env) templates)))] (|> data' @@ -5193,7 +5195,7 @@ (case fragment (#Doc-Comment comment) (|> comment - (split-text "\n") + (text/split "\n") (map (function [line] ($_ text/compose "## " line "\n"))) text/join) @@ -5574,7 +5576,7 @@ (~ g!_) #;None))) (` (#;Some (~ body))) - (: (List [Code Code]) (reverse levels)))] + (: (List [Code Code]) (list/reverse levels)))] (list init-pattern inner-pattern-body))) (macro: #export (^multi tokens) @@ -5680,7 +5682,7 @@ (^ (list [_ (#Nat idx)])) (do Monad [stvs get-scope-type-vars] - (case (list-at idx (reverse stvs)) + (case (list-at idx (list/reverse stvs)) (#;Some var-id) (wrap (list (` (#Ex (~ (nat$ var-id)))))) @@ -6060,11 +6062,11 @@ (^template [] [_ ( elems)] - (case (reverse elems) + (case (list/reverse elems) (#;Cons [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [spliced #Nil])]))] inits) (do Monad - [=inits (monad/map Monad untemplate-pattern (reverse inits)) + [=inits (monad/map Monad untemplate-pattern (list/reverse inits)) g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) ( (~ (untemplate-list& spliced =inits)))]))) diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 848350499..dbe11b3a0 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -15,7 +15,7 @@ ["csw" writer]))) (type opaque) (lang [type])) - (.. ["A" atom] + (// ["A" atom] ["P" promise "P/" Monad] ["T" task] [stm #+ Monad] diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index d59b96563..ce5069b45 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -10,7 +10,7 @@ text/format) [macro] (macro ["s" syntax #+ syntax: Syntax])) - (.. ["&" promise])) + (// ["&" promise])) ## [Types] (type: #export (Channel a) diff --git a/stdlib/source/lux/control/applicative.lux b/stdlib/source/lux/control/applicative.lux index d2b505941..935fda18e 100644 --- a/stdlib/source/lux/control/applicative.lux +++ b/stdlib/source/lux/control/applicative.lux @@ -1,6 +1,6 @@ (;module: lux - (.. [functor #+ Functor])) + (// [functor #+ Functor])) (sig: #export (Applicative f) {#;doc "Applicative functors."} diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 7886d8c3c..15625b8f1 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -1,6 +1,6 @@ (;module: lux - ["F" ../functor] + ["F" //functor] (lux/data/coll [list "list/" Fold])) ## [Signatures] diff --git a/stdlib/source/lux/control/hash.lux b/stdlib/source/lux/control/hash.lux index 3472098c1..ae72d4cf0 100644 --- a/stdlib/source/lux/control/hash.lux +++ b/stdlib/source/lux/control/hash.lux @@ -1,6 +1,6 @@ (;module: lux - (.. [eq #+ Eq])) + (// [eq #+ Eq])) ## [Signatures] (sig: #export (Hash a) diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index b9ecf5470..fb900d3e7 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -1,6 +1,6 @@ (;module: lux - (.. (functor #as F) + (// (functor #as F) (applicative #as A))) ## [Utils] diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index 89708d986..fe8169443 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -1,7 +1,7 @@ (;module: lux (lux function) - (.. [eq #+ Eq])) + (// [eq #+ Eq])) ## [Signatures] (sig: #export (Order a) diff --git a/stdlib/source/lux/data/coll/tree/parser.lux b/stdlib/source/lux/data/coll/tree/parser.lux index 3b2400b92..ac6dc2a85 100644 --- a/stdlib/source/lux/data/coll/tree/parser.lux +++ b/stdlib/source/lux/data/coll/tree/parser.lux @@ -3,7 +3,7 @@ (lux (control ["p" parser] ["ex" exception #+ exception:]) (data ["E" error])) - (.. ["T" rose] + (// ["T" rose] ["Z" zipper])) (type: #export (Parser t a) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 33ac0b89b..e800efcd5 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -10,7 +10,7 @@ ["e" error] [text "text/" Monoid Eq] (coll [list "list/" Monoid Monad]))) - (. [code])) + (/ [code])) ## (type: (Meta a) ## (-> Compiler (e;Error [Compiler a]))) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 5c3a645ee..6b4d5fed5 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -16,7 +16,7 @@ (coll [list "list/" Fold Monad] [sequence #+ Sequence sequence "sequence/" Monad] ["d" dict]) - (format [".." json #+ JSON])) + (format ["//" json #+ JSON])) (time ["i" instant] ["du" duration] ["da" date]) @@ -50,13 +50,13 @@ (def: (encode input) (let [high (|> input (bit;and high-mask) (bit;shift-right +32)) low (bit;and low-mask input)] - (#..;Array (sequence (|> high nat-to-int int-to-frac #..;Number) - (|> low nat-to-int int-to-frac #..;Number))))) + (#//;Array (sequence (|> high nat-to-int int-to-frac #//;Number) + (|> low nat-to-int int-to-frac #//;Number))))) (def: (decode input) - (<| (..;run input) + (<| (//;run input) (do p;Monad - [high ..;number - low ..;number]) + [high //;number + low //;number]) (wrap (n.+ (|> high frac-to-int int-to-nat (bit;shift-left +32)) (|> low frac-to-int int-to-nat)))))) @@ -70,7 +70,7 @@ (All [a] (-> (-> a JSON) (-> (Maybe a) JSON))) (function [elem] (case elem - #;None #..;Null + #;None #//;Null (#;Some value) (writer value)))) (struct: #hidden (Codec carrier) @@ -88,17 +88,17 @@ (wrap (` (: (~ (@JSON//encode inputT)) ))))] - [Unit poly;unit (function [(~ (code;symbol ["" "0"]))] #..;Null)] - [Bool poly;bool (|>. #..;Boolean)] + [Unit poly;unit (function [(~ (code;symbol ["" "0"]))] #//;Null)] + [Bool poly;bool (|>. #//;Boolean)] [Nat poly;nat (:: ;;Codec (~' encode))] [Int poly;int (:: ;;Codec (~' encode))] - [Frac poly;frac (|>. #..;Number)] - [Text poly;text (|>. #..;String)]) + [Frac poly;frac (|>. #//;Number)] + [Text poly;text (|>. #//;String)])