diff options
Diffstat (limited to 'stdlib/source/library')
191 files changed, 5655 insertions, 5653 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 5c6c625a8..7ff877259 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1337,32 +1337,34 @@ (function' [right left] (func left right))) -(macro:' .public (_$ tokens) +(macro:' .public (left tokens) ({{#Item op tokens'} ({{#Item first nexts} (meta#in (list (list#mix (function#flipped (right_associativity op)) first nexts))) _ - (failure "Wrong syntax for _$")} + (failure "Wrong syntax for left")} tokens') _ - (failure "Wrong syntax for _$")} + (failure "Wrong syntax for left")} tokens)) -(macro:' .public ($_ tokens) +(macro:' .public (right tokens) ({{#Item op tokens'} ({{#Item last prevs} (meta#in (list (list#mix (right_associativity op) last prevs))) _ - (failure "Wrong syntax for $_")} + (failure "Wrong syntax for right")} (list#reversed tokens')) _ - (failure "Wrong syntax for $_")} + (failure "Wrong syntax for right")} tokens)) +(def:''' .public all Macro ..right) + ... (type: (Monad m) ... (Interface ... (is (All (_ a) (-> a (m a))) @@ -1531,7 +1533,7 @@ (-> Symbol Text) (let' [[module name] full_name] ({"" name - _ ($_ text#composite module ..symbol_separator name)} + _ (all text#composite module ..symbol_separator name)} module))) (def:''' .private (global_symbol full_name state) @@ -1553,11 +1555,11 @@ constant) {#None} - {#Left ($_ text#composite "Unknown definition: " (symbol#encoded full_name))}} + {#Left (all text#composite "Unknown definition: " (symbol#encoded full_name))}} (plist#value name definitions)) {#None} - {#Left ($_ text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} + {#Left (all text#composite "Unknown module: " module " @ " (symbol#encoded full_name))}} (plist#value module modules)))) (def:''' .private (:List<Code> expression) @@ -2200,7 +2202,7 @@ (def:''' .private (text#encoded original) (-> Text Text) - ($_ text#composite ..double_quote original ..double_quote)) + (all text#composite ..double_quote original ..double_quote)) (def:''' .private (code#encoded code) (-> Code Text) @@ -2226,25 +2228,25 @@ (symbol#encoded [module name]) [_ {#Form xs}] - ($_ text#composite "(" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) ")") + (all text#composite "(" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) ")") [_ {#Tuple xs}] - ($_ text#composite "[" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "]") + (all text#composite "[" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "]") [_ {#Variant xs}] - ($_ text#composite "{" (|> xs - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite "")) "}")} + (all text#composite "{" (|> xs + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite "")) "}")} code)) (def:''' .private (normal_type type) @@ -2360,7 +2362,7 @@ ..#seed ("lux i64 +" 1 seed) ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] - (local$ ($_ text#composite "__gensym__" prefix (nat#encoded seed)))}} + (local$ (all text#composite "__gensym__" prefix (nat#encoded seed)))}} state)) (macro:' .public (exec tokens) @@ -2440,11 +2442,11 @@ (do meta_monad [] (in (list))) _ - (failure ($_ text#composite "'lux.case' expects an even number of tokens: " (|> branches - (list#each code#encoded) - (list#interposed " ") - list#reversed - (list#mix text#composite ""))))} + (failure (all text#composite "'lux.case' expects an even number of tokens: " (|> branches + (list#each code#encoded) + (list#interposed " ") + list#reversed + (list#mix text#composite ""))))} branches)) (macro:' .public (case tokens) @@ -3000,7 +3002,7 @@ {#Right state module} _ - {#Left ($_ text#composite "Unknown module: " name)})))) + {#Left (all text#composite "Unknown module: " name)})))) (def: (type_slot [module name]) (-> Symbol (Meta [Nat (List Symbol) Bit Type])) @@ -3083,38 +3085,38 @@ name _ - ($_ text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")) + (all text#composite "(" name " " (|> params (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")")) {#Sum _} - ($_ text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") + (all text#composite "{" (|> (flat_variant type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "}") {#Product _} - ($_ text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") + (all text#composite "[" (|> (flat_tuple type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) "]") {#Function _} - ($_ text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") + (all text#composite "(-> " (|> (flat_lambda type) (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) ")") {#Parameter id} (nat#encoded id) {#Var id} - ($_ text#composite "-" (nat#encoded id)) + (all text#composite "-" (nat#encoded id)) {#Ex id} - ($_ text#composite "+" (nat#encoded id)) + (all text#composite "+" (nat#encoded id)) {#UnivQ env body} - ($_ text#composite "(All " (type#encoded body) ")") + (all text#composite "(All " (type#encoded body) ")") {#ExQ env body} - ($_ text#composite "(Ex " (type#encoded body) ")") + (all text#composite "(Ex " (type#encoded body) ")") {#Apply _} (let [[func args] (flat_application type)] - ($_ text#composite - "(" (type#encoded func) " " - (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) - ")")) + (all text#composite + "(" (type#encoded func) " " + (|> args (list#each type#encoded) (list#interposed " ") list#reversed (list#mix text#composite "")) + ")")) {#Named name _} (symbol#encoded name) @@ -3131,9 +3133,9 @@ (meta#in tags) _ - (failure ($_ text#composite - "No tags available for type: " - (type#encoded struct_type))))) + (failure (all text#composite + "No tags available for type: " + (type#encoded struct_type))))) .let [tag_mappings (is (List [Text Code]) (list#each (function (_ tag) [(product#right tag) @@ -3164,7 +3166,7 @@ {#Item head tail} (list#mix (function (_ right left) - ($_ text#composite left separator right)) + (all text#composite left separator right)) head tail))) @@ -3478,7 +3480,7 @@ (function (again left right) (case (..text#split_by pattern right) {#Some [pre post]} - (again ($_ "lux text concat" left pre replacement) post) + (again (all "lux text concat" left pre replacement) post) {#None} ("lux text concat" left right)))) @@ -3486,7 +3488,7 @@ (def: (alias_stand_in index) (-> Nat Text) - ($_ "lux text concat" "[" (nat#encoded index) "]")) + (all "lux text concat" "[" (nat#encoded index) "]")) (def: (module_alias context aliased) (-> (List Text) Text Text) @@ -3514,7 +3516,7 @@ _ (case root "" hierarchy - _ ($_ text#composite root ..module_separator hierarchy)))) + _ (all text#composite root ..module_separator hierarchy)))) (def: (normal_parallel_path hierarchy root) (-> Text Text (Maybe Text)) @@ -3550,7 +3552,7 @@ (case (relative_ups 0 module) 0 (meta#in (if nested? - ($_ "lux text concat" relative_root ..module_separator module) + (all "lux text concat" relative_root ..module_separator module) module)) relatives @@ -3565,12 +3567,12 @@ clean ("lux text clip" relatives (|> module "lux text size" ("lux i64 -" relatives)) module) output (case ("lux text size" clean) 0 prefix - _ ($_ text#composite prefix ..module_separator clean))] + _ (all text#composite prefix ..module_separator clean))] (meta#in output)) - (failure ($_ "lux text concat" - "Cannot climb the module hierarchy..." \n - "Importing module: " module \n - " Relative Root: " relative_root \n)))))) + (failure (all "lux text concat" + "Cannot climb the module hierarchy..." \n + "Importing module: " module \n + " Relative Root: " relative_root \n)))))) (def: (imports_parser nested? relative_root context imports) (-> Bit Text (List Text) (List Code) (Meta (List Importation))) @@ -3642,9 +3644,9 @@ _ (do meta_monad [current_module current_module_name] - (failure ($_ text#composite - "Wrong syntax for import @ " current_module - \n (code#encoded token))))))) + (failure (all text#composite + "Wrong syntax for import @ " current_module + \n (code#encoded token))))))) imports)] (in (list#conjoint imports')))) @@ -3685,19 +3687,19 @@ {#Right state (list#conjoint to_alias)}) {#None} - {#Left ($_ text#composite - "Unknown module: " (text#encoded module) \n - "Current module: " (case current_module - {#Some current_module} - (text#encoded current_module) - - {#None} - "???") \n - "Known modules: " (|> modules - (list#each (function (_ [name module]) - (text$ name))) - tuple$ - code#encoded))}) + {#Left (all text#composite + "Unknown module: " (text#encoded module) \n + "Current module: " (case current_module + {#Some current_module} + (text#encoded current_module) + + {#None} + "???") \n + "Known modules: " (|> modules + (list#each (function (_ [name module]) + (text$ name))) + tuple$ + code#encoded))}) )) (def: (list#only p xs) @@ -3846,13 +3848,13 @@ {#Right [compiler struct_type]} _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})) + {#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})) (case (definition_type full_name compiler) {#Some struct_type} {#Right [compiler struct_type]} _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})))] + {#Left (all text#composite "Unknown var: " (symbol#encoded full_name))})))] (case temp {#Right [compiler {#Var type_id}]} (let [[..#info _ ..#source _ ..#current_module _ ..#modules _ @@ -4108,11 +4110,11 @@ #refer_open openings]) _ - (failure ($_ text#composite "Wrong syntax for refer @ " current_module - \n (|> options - (list#each code#encoded) - (list#interposed " ") - (list#mix text#composite ""))))))) + (failure (all text#composite "Wrong syntax for refer @ " current_module + \n (|> options + (list#each code#encoded) + (list#interposed " ") + (list#mix text#composite ""))))))) (def: (referral_definitions module_name [r_defs r_opens]) (-> Text Refer (Meta (List Code))) @@ -4125,7 +4127,7 @@ (function (_ _def) (if (is_member? all_defs _def) (meta#in []) - (failure ($_ text#composite _def " is not defined in module " module_name " @ " current_module))))) + (failure (all text#composite _def " is not defined in module " module_name " @ " current_module))))) referred_defs)))] defs' (case r_defs {#All} @@ -4528,10 +4530,10 @@ (single_expansion expr) _ - (failure ($_ text#composite - "Incorrect expansion in with_expansions" - " | Binding: " (text#encoded var_name) - " | Expression: " (code#encoded expr))))] + (failure (all text#composite + "Incorrect expansion in with_expansions" + " | Binding: " (text#encoded var_name) + " | Expression: " (code#encoded expr))))] (again &rest (plist#with var_name expansion map))) {#End} @@ -4730,8 +4732,8 @@ (do meta_monad [location ..location .let [[module line column] location - location ($_ "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) - message ($_ "lux text concat" "Undefined behavior @ " location)]] + location (all "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) + message (all "lux text concat" "Undefined behavior @ " location)]] (in (list (` (..panic! (~ (text$ message))))))) _ @@ -4836,14 +4838,14 @@ (in (as ..Text value)) _ - (failure ($_ text#composite - "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) - " : " (..code#encoded (..type_code type)))))) + (failure (all text#composite + "Invalid target platform (must be a value of type Text): " (symbol#encoded symbol) + " : " (..code#encoded (..type_code type)))))) _ - (failure ($_ text#composite - "Invalid target platform syntax: " (..code#encoded choice) - \n "Must be either a text literal or a symbol.")))) + (failure (all text#composite + "Invalid target platform syntax: " (..code#encoded choice) + \n "Must be either a text literal or a symbol.")))) (def: (target_pick target options default) (-> Text (List [Code Code]) (Maybe Code) (Meta (List Code))) @@ -4851,7 +4853,7 @@ {#End} (case default {#None} - (failure ($_ text#composite "No code for target platform: " target)) + (failure (all text#composite "No code for target platform: " target)) {#Some default} (meta#in (list default))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index 9a63c3747..90fedf8d3 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -36,7 +36,7 @@ (# f_apply on fgx fgf'))) ... (let [applyF (# f_apply on) ... applyG (# g_apply on)] - ... ($_ applyF + ... (all applyF ... fgf ... (# f_monad in applyG) ... fgx)) diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 72057bf06..c1b40888f 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -39,7 +39,7 @@ {.#Some bindings} (let [[module short] (symbol ..be) symbol (is (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) + (|>> (all "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) g!_ (symbol "_") g!each (symbol "each") g!disjoint (symbol "disjoint") diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 79152d481..6c853b9e4 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" all} [meta ["[0]" location]]]] [// @@ -69,7 +69,7 @@ (if (|> bindings list#size .int ("lux i64 %" +2) ("lux i64 =" +0)) (let [[module short] (symbol ..do) symbol (is (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) + (|>> (.all "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) g!_ (symbol "_") g!each (symbol "each") g!conjoint (symbol "conjoint") diff --git a/stdlib/source/library/lux/abstract/predicate.lux b/stdlib/source/library/lux/abstract/predicate.lux index e785b7ae4..7e87cfc9d 100644 --- a/stdlib/source/library/lux/abstract/predicate.lux +++ b/stdlib/source/library/lux/abstract/predicate.lux @@ -1,12 +1,12 @@ (.using - [library - [lux {"-" or and} - [control - ["[0]" function]]]] - [// - [monoid {"+" Monoid}] - [functor - ["[0]" contravariant]]]) + [library + [lux {"-" all or and} + [control + ["[0]" function]]]] + [// + [monoid {"+" Monoid}] + [functor + ["[0]" contravariant]]]) (type: .public (Predicate a) (-> a Bit)) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 3fb95ed21..59c692222 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -76,8 +76,8 @@ (def: signature^ (Parser [(List Alias) Stack Stack]) - (<>.either ($_ <>.and aliases^ stack^ stack^) - ($_ <>.and (<>#in (list)) stack^ stack^))) + (<>.either (all <>.and aliases^ stack^ stack^) + (all <>.and (<>#in (list)) stack^ stack^))) (syntax: .public (=> [[aliases inputs outputs] signature^]) (let [de_alias (function (_ aliased) @@ -119,10 +119,10 @@ (def: word (Parser [Code Text Code (List Code)]) (|export|.parser - ($_ <>.and - <code>.local - <code>.any - (<>.many <code>.any)))) + (all <>.and + <code>.local + <code>.any + (<>.many <code>.any)))) (syntax: .public (word: [[export_policy name type commands] ..word]) (in (list (` (def: (~ export_policy) (~ (code.local name)) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 8334f6f41..25fad05eb 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -3,7 +3,7 @@ [lux "*" ["[0]" debug] [abstract - monad] + [monad {"+" do}]] [control ["[0]" pipe] ["[0]" function] @@ -229,14 +229,14 @@ (def: on_mail^ (Parser (Maybe On_MailC)) (<>.maybe (<code>.form (<>.and (<code>.form (<>.after (<code>.this (' on_mail)) - ($_ <>.and ..argument ..argument ..argument))) + (all <>.and ..argument ..argument ..argument))) <code>.any)))) (def: behavior^ (Parser BehaviorC) - ($_ <>.and - ..on_mail^ - (<>.some <code>.any))) + (all <>.and + ..on_mail^ + (<>.some <code>.any))) (def: (on_mail g!_ ?on_mail) (-> Code (Maybe On_MailC) Code) @@ -254,10 +254,10 @@ (def: actorP (Parser [Code [Text (List Text)] Code BehaviorC]) (|export|.parser - ($_ <>.and - ..actor_decl^ - <code>.any - behavior^))) + (all <>.and + ..actor_decl^ + <code>.any + behavior^))) (syntax: .public (actor: [[export_policy [name vars] state_type [?on_mail messages]] ..actorP]) (with_symbols [g!_] @@ -296,12 +296,12 @@ (def: signature^ (Parser Signature) - (<code>.form ($_ <>.and - (<>.else (list) (<code>.tuple (<>.some <code>.local))) - <code>.local - |input|.parser - <code>.local - <code>.local))) + (<code>.form (all <>.and + (<>.else (list) (<code>.tuple (<>.some <code>.local))) + <code>.local + |input|.parser + <code>.local + <code>.local))) (def: reference^ (Parser [Symbol (List Text)]) @@ -311,10 +311,10 @@ (def: messageP (Parser [Code Signature Code Code]) (|export|.parser - ($_ <>.and - ..signature^ - <code>.any - <code>.any))) + (all <>.and + ..signature^ + <code>.any + <code>.any))) (syntax: .public (message: [[export_policy signature output_type body] ..messageP]) (with_symbols [g!_ g!return] diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 619b9733d..0902501b4 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -112,9 +112,9 @@ (case (try (io.run! action)) {try.#Failure error} (exec - ("lux io log" ($_ "lux text concat" - "ERROR DURING THREAD EXECUTION:" text.new_line - error)) + ("lux io log" (all "lux text concat" + "ERROR DURING THREAD EXECUTION:" text.new_line + error)) []) {try.#Success _} diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 3d34b95f7..173b8b9bf 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -79,22 +79,22 @@ (def: exception (Parser [Code (List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) (let [private (is (Parser [(List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) - ($_ <>.and - (<>.else (list) (<code>.tuple (<>.some |type_variable|.parser))) - (<>.either (<code>.form (<>.and <code>.local |input|.parser)) - (<>.and <code>.local (<>#in (list)))) - (<>.maybe <code>.any) - ))] - ($_ <>.either - (<>.and <code>.any private) - (<>.and (<>#in (` .private)) private) - ))) + (all <>.and + (<>.else (list) (<code>.tuple (<>.some |type_variable|.parser))) + (<>.either (<code>.form (<>.and <code>.local |input|.parser)) + (<>.and <code>.local (<>#in (list)))) + (<>.maybe <code>.any) + ))] + (all <>.either + (<>.and <code>.any private) + (<>.and (<>#in (` .private)) private) + ))) (syntax: .public (exception: [[export_policy t_vars [name inputs] body] ..exception]) (macro.with_symbols [g!_ g!descriptor] (do meta.monad [current_module meta.current_module_name - .let [descriptor ($_ text#composite "{" current_module "." name "}" text.new_line) + .let [descriptor (all text#composite "{" current_module "." name "}" text.new_line) g!self (code.local name)]] (in (list (` (def: (~ export_policy) (~ g!self) @@ -126,14 +126,14 @@ text.together)] (|> message (text.replaced text.new_line on_new_line) - ($_ text#composite padding header header_separator)))))] + (all text#composite padding header header_separator)))))] (case entries {.#End} "" {.#Item head tail} (list#mix (function (_ post pre) - ($_ text#composite pre text.new_line (on_entry post))) + (all text#composite pre text.new_line (on_entry post))) (on_entry head) tail)))) @@ -156,19 +156,19 @@ ..report')) (def: separator - (let [gap ($_ "lux text concat" text.new_line text.new_line) + (let [gap (all "lux text concat" text.new_line text.new_line) horizontal_line (|> "-" (list.repeated 64) text.together)] - ($_ "lux text concat" - gap - horizontal_line - gap))) + (all "lux text concat" + gap + horizontal_line + gap))) (def: (decorated prelude error) (-> Text Text Text) - ($_ "lux text concat" - prelude - ..separator - error)) + (all "lux text concat" + prelude + ..separator + error)) (def: .public (with exception message computation) (All (_ e a) (-> (Exception e) e (Try a) (Try a))) diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index 80674c8eb..8785e6cb7 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -22,11 +22,11 @@ (def: inline (Parser [Code [Text (List Code)] Code Code]) (|export|.parser - ($_ <>.and - ..declaration - <code>.any - <code>.any - ))) + (all <>.and + ..declaration + <code>.any + <code>.any + ))) (syntax: .public (inline: [[privacy [name parameters] type term] ..inline]) (do [! meta.monad] diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 1c75c9f07..95a7f132f 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -32,11 +32,11 @@ (.def: mutual (Parser [Declaration Code Code]) - ($_ <>.and - declaration.parser - <code>.any - <code>.any - )) + (all <>.and + declaration.parser + <code>.any + <code>.any + )) (.def: (mutual_definition context g!context [g!name mutual]) (-> (List Code) Code [Code Mutual] Code) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 1e360a194..2c32f7b8d 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -286,7 +286,7 @@ (def: .public location (Parser Location) - ($_ //.and ..text ..nat ..nat)) + (all //.and ..text ..nat ..nat)) (def: .public code (Parser Code) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 516e6ff2e..70a65f6e5 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -35,7 +35,7 @@ (-> (List Code) Text) (|>> (list#each code.format) (text.interposed " ") - ($_ text#composite text.new_line "Remaining input: "))) + (all text#composite text.new_line "Remaining input: "))) (def: .public any (Parser Code) @@ -58,7 +58,7 @@ {try.#Success [tokens next]}))) (template [<query> <check> <type> <tag> <eq> <desc>] - [(with_expansions [<failure> (these {try.#Failure ($_ text#composite "Cannot parse " <desc> (remaining_inputs tokens))})] + [(with_expansions [<failure> (these {try.#Failure (all text#composite "Cannot parse " <desc> (remaining_inputs tokens))})] (def: .public <query> (Parser <type>) (function (_ tokens) @@ -97,13 +97,13 @@ {.#Item [token tokens']} (if (code#= code token) {try.#Success [tokens' []]} - {try.#Failure ($_ text#composite "Expected a " (code.format code) " but instead got " (code.format token) - (remaining_inputs tokens))}) + {try.#Failure (all text#composite "Expected a " (code.format code) " but instead got " (code.format token) + (remaining_inputs tokens))}) _ {try.#Failure "There are no tokens to parse!"}))) -(with_expansions [<failure> (these {try.#Failure ($_ text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] +(with_expansions [<failure> (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] (def: .public local (Parser Text) (function (_ tokens) @@ -126,7 +126,7 @@ _ <failure>)))) -(with_expansions [<failure> (these {try.#Failure ($_ text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] +(with_expansions [<failure> (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] (def: .public global (Parser Symbol) (function (_ tokens) @@ -164,10 +164,10 @@ {.#Item [[_ {<tag> members}] tokens']} (case (p members) {try.#Success [{.#End} x]} {try.#Success [tokens' x]} - _ {try.#Failure ($_ text#composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens))}) + _ {try.#Failure (all text#composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens))}) _ - {try.#Failure ($_ text#composite "Cannot parse " <desc> (remaining_inputs tokens))})))] + {try.#Failure (all text#composite "Cannot parse " <desc> (remaining_inputs tokens))})))] [form .#Form "form"] [variant .#Variant "variant"] @@ -179,7 +179,7 @@ (function (_ tokens) (case tokens {.#End} {try.#Success [tokens []]} - _ {try.#Failure ($_ text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) + _ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) (def: .public end? (Parser Bit) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index 1e380a218..b4f3daa90 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -177,7 +177,7 @@ (do //.monad [char any .let [char' (maybe.trusted (/.char 0 char))] - _ (//.assertion ($_ /#composite "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) + _ (//.assertion (all /#composite "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) (.and (n.>= bottom char') (n.<= top char')))] (in char))) @@ -188,7 +188,7 @@ [it ..any! char (..slice (in it)) .let [char' (maybe.trusted (/.char 0 char))] - _ (//.assertion ($_ /#composite "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) + _ (//.assertion (all /#composite "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) (.and (n.>= bottom char') (n.<= top char')))] (in it))) @@ -216,17 +216,17 @@ (def: .public hexadecimal (Parser Text) - ($_ //.either - ..decimal - (..range (char "a") (char "f")) - (..range (char "A") (char "F")))) + (all //.either + ..decimal + (..range (char "a") (char "f")) + (..range (char "A") (char "F")))) (def: .public hexadecimal! (Parser Slice) - ($_ //.either - ..decimal! - (..range! (char "a") (char "f")) - (..range! (char "A") (char "F")))) + (all //.either + ..decimal! + (..range! (char "a") (char "f")) + (..range! (char "A") (char "F")))) (template [<name>] [(exception: .public (<name> [options Text @@ -319,7 +319,7 @@ (do //.monad [=left left =right right] - (in ($_ /#composite =left =right)))) + (in (all /#composite =left =right)))) (def: .public (and! left right) (-> (Parser Slice) (Parser Slice) (Parser Slice)) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 6828da45a..2db46e2b5 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" left right} [abstract [monad {"+" do}]] [control diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 3b837d8a9..f95894b0b 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -137,7 +137,7 @@ (def: (label idx) (-> Nat Code) - (code.local ($_ text#composite "label" text.tab (n#encoded idx)))) + (code.local (all text#composite "label" text.tab (n#encoded idx)))) (def: .public (with_extension type poly) (All (_ a) (-> Type (Parser a) (Parser [Code a]))) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 3a895593e..672783d02 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -38,17 +38,17 @@ (def: deadline (Parser Date) - ($_ <>.either - (<>#each (|>> instant.of_millis instant.date) - <c>.int) - (do <>.monad - [raw <c>.text] - (case (# date.codec decoded raw) - {try.#Success date} - (in date) - - {try.#Failure message} - (<>.failure message))))) + (all <>.either + (<>#each (|>> instant.of_millis instant.date) + <c>.int) + (do <>.monad + [raw <c>.text] + (case (# date.codec decoded raw) + {try.#Success date} + (in date) + + {try.#Failure message} + (<>.failure message))))) (syntax: .public (remember [deadline ..deadline message <c>.text diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 322f2cf5b..4878554bf 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -41,9 +41,9 @@ (syntax: .public (capability: [[export_policy declaration [forger input output]] (|export|.parser - ($_ <>.and - |declaration|.parser - (<c>.form ($_ <>.and <c>.local <c>.any <c>.any))))]) + (all <>.and + |declaration|.parser + (<c>.form (all <>.and <c>.local <c>.any <c>.any))))]) (macro.with_symbols [g!_] (do [! meta.monad] [this_module meta.current_module_name diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index b2c5b02fc..1fd3037b9 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -159,9 +159,9 @@ text$ ("lux in-module" "library/lux" .text$)] {.#Right [state (.list (` (.if (~ test) (~ then) - {..#Failure (~ (text$ ($_ "lux text concat" - "[" (code#encoded (` .when)) "]" - " " "Invalid condition:")))})))]}) + {..#Failure (~ (text$ (all "lux text concat" + "[" (code#encoded (` .when)) "]" + " " "Invalid condition:")))})))]}) _ {.#Left "Wrong syntax for 'when'"})) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index e099a841b..3c95f2544 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -552,10 +552,10 @@ (list) {.#Some node'} - ($_ list#composite - (again (the #left node')) - (list <output>) - (again (the #right node'))))))] + (all list#composite + (again (the #left node')) + (list <output>) + (again (the #right node'))))))] [entries [k v] [(the #key node') (the #value node')]] [keys k (the #key node')] diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index e0f68faa3..19ac281fc 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" revised} + [lux {"-" revised all} ["@" target] [abstract [monoid {"+" Monoid}] @@ -387,7 +387,7 @@ (is (~~ (type_of xs)) (list))]) xs')] - ($_ composite (sorted < pre) (list x) (sorted < post))))) + (.all composite (sorted < pre) (list x) (sorted < post))))) (def: .public (empty? xs) (All (_ a) (Predicate (List a))) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index e45697595..d0790fa4f 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" left right} ["@" target] [abstract [functor {"+" Functor}] @@ -35,13 +35,13 @@ (Equivalence (Zipper a)))) (def: (= reference sample) - (let [== ($_ product.equivalence - (maybe.equivalence - ($_ product.equivalence - = - (list.equivalence (//.equivalence super)) - (list.equivalence (//.equivalence super)))) - (//.equivalence super))] + (let [== (all product.equivalence + (maybe.equivalence + (all product.equivalence + = + (list.equivalence (//.equivalence super)) + (list.equivalence (//.equivalence super)))) + (//.equivalence super))] (== reference sample)))) (def: .public (zipper tree) diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index dc2f0fff7..7a907d83e 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -81,10 +81,10 @@ (def: (hash value) (let [[r g b] (representation value)] - ($_ i64.or - (i64.left_shifted 16 r) - (i64.left_shifted 8 g) - b)))) + (all i64.or + (i64.left_shifted 16 r) + (i64.left_shifted 8 g) + b)))) (def: .public black Color @@ -140,8 +140,8 @@ red (..down red) green (..down green) blue (..down blue) - max ($_ f.max red green blue) - min ($_ f.min red green blue) + max (all f.max red green blue) + min (all f.min red green blue) luminance (|> (f.+ max min) (f./ +2.0))] (if (f.= max min) ... Achromatic @@ -212,8 +212,8 @@ red (..down red) green (..down green) blue (..down blue) - max ($_ f.max red green blue) - min ($_ f.min red green blue) + max (all f.max red green blue) + min (all f.min red green blue) brightness max diff (|> max (f.- min)) saturation (if (f.= +0.0 max) @@ -261,7 +261,7 @@ red (..down red) green (..down green) blue (..down blue) - key (|> +1.0 (f.- ($_ f.max red green blue))) + key (|> +1.0 (f.- (all f.max red green blue))) f (if (f.< +1.0 key) (|> +1.0 (f./ (|> +1.0 (f.- key)))) +0.0) diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 6e9e000ad..88ee81c34 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -265,7 +265,7 @@ (def: .public location (Writer Location) - ($_ ..and ..text ..nat ..nat)) + (all ..and ..text ..nat ..nat)) (def: .public code (Writer Code) diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 28d3c849a..418513440 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -297,15 +297,15 @@ (def: .public (each attributes areas for) (-> Attributes (List [Attributes Shape]) Image Image) - ($_ ..and - for - (case (list#each (product.uncurried ..area) areas) - {.#End} - (..empty "map" attributes) - - {.#Item head tail} - (..tag "map" attributes - (list#mix (function.flipped ..and) head tail))))) + (all ..and + for + (case (list#each (product.uncurried ..area) areas) + {.#End} + (..empty "map" attributes) + + {.#Item head tail} + (..tag "map" attributes + (list#mix (function.flipped ..and) head tail))))) (.template [<name> <tag> <type>] [(def: .public <name> @@ -349,9 +349,9 @@ (..tag <container_tag> attributes (case description {.#Some description} - ($_ ..and - (..tag <description_tag> (list) description) - content) + (all ..and + (..tag <description_tag> (list) description) + content) {.#None} content)))] @@ -417,17 +417,17 @@ (def: (ruby_pronunciation pronunciation) (-> Content (HTML Any)) (..tag "rt" (list) - ($_ ..and - (..tag "rp" (list) (..text "(")) - pronunciation - (..tag "rp" (list) (..text ")"))))) + (all ..and + (..tag "rp" (list) (..text "(")) + pronunciation + (..tag "rp" (list) (..text ")"))))) (def: .public (ruby attributes content pronunciation) (-> Attributes Content Content Element) (..tag "ruby" attributes - ($_ ..and - content - (ruby_pronunciation pronunciation)))) + (all ..and + content + (ruby_pronunciation pronunciation)))) (type: .public Composite (-> Attributes Element Element)) @@ -462,9 +462,9 @@ (def: .public (description_list attributes descriptions) (-> Attributes (List [Content Element]) Element) (case (list#each (function (_ [term description]) - ($_ ..and - (..term term) - (..description description))) + (all ..and + (..term term) + (..description description))) descriptions) {.#End} (..empty "dl" attributes) diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 2f21d8dc5..1eb7c31fb 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -83,17 +83,17 @@ (<code>.Parser JSON') (<>.rec (function (_ jsonP) - ($_ <>.or - (<code>.form (<>#in [])) - <code>.bit - <code>.frac - <code>.text - (<>#each sequence.of_list - (<code>.tuple (<>.some jsonP))) - (<>#each (dictionary.of_list text.hash) - (<code>.variant (<>.some (<>.and <code>.text jsonP)))) - <code>.any - )))) + (all <>.or + (<code>.form (<>#in [])) + <code>.bit + <code>.frac + <code>.text + (<>#each sequence.of_list + (<code>.tuple (<>.some jsonP))) + (<>#each (dictionary.of_list text.hash) + (<code>.variant (<>.some (<>.and <code>.text jsonP)))) + <code>.any + )))) (def: (jsonF token) (-> JSON' Code) @@ -132,7 +132,7 @@ {try.#Success (dictionary.keys obj)} _ - {try.#Failure ($_ text#composite "Cannot get the fields of a non-object.")})) + {try.#Failure (all text#composite "Cannot get the fields of a non-object.")})) (def: .public (field key json) (-> String JSON (Try JSON)) @@ -143,10 +143,10 @@ {try.#Success value} {.#None} - {try.#Failure ($_ text#composite "Missing field '" key "' on object.")}) + {try.#Failure (all text#composite "Missing field '" key "' on object.")}) _ - {try.#Failure ($_ text#composite "Cannot get field '" key "' on a non-object.")})) + {try.#Failure (all text#composite "Cannot get field '" key "' on a non-object.")})) (def: .public (has key value json) (-> String JSON JSON (Try JSON)) @@ -155,7 +155,7 @@ {try.#Success {#Object (dictionary.has key value obj)}} _ - {try.#Failure ($_ text#composite "Cannot set field '" key "' on a non-object.")})) + {try.#Failure (all text#composite "Cannot set field '" key "' on a non-object.")})) (template [<name> <tag> <type>] [(def: .public (<name> key json) @@ -165,7 +165,7 @@ {try.#Success value} {try.#Success _} - {try.#Failure ($_ text#composite "Wrong value type at key: " key)} + {try.#Failure (all text#composite "Wrong value type at key: " key)} {try.#Failure error} {try.#Failure error}))] @@ -275,11 +275,11 @@ (def: (kv_format format [key value]) (-> (-> JSON Text) (-> [String JSON] Text)) - ($_ text#composite - (..string_format key) - ..entry_separator - (format value) - )) + (all text#composite + (..string_format key) + ..entry_separator + (format value) + )) (def: (object_format format) (-> (-> JSON Text) (-> Object Text)) @@ -312,10 +312,10 @@ (def: value_separator_parser (Parser [Text Any Text]) - ($_ <>.and - ..space_parser - (<text>.this ..value_separator) - ..space_parser)) + (all <>.and + ..space_parser + (<text>.this ..value_separator) + ..space_parser)) (def: null_parser (Parser Null) @@ -336,9 +336,9 @@ (def: boolean_parser (Parser Boolean) - ($_ <>.either - ..true_parser - ..false_parser)) + (all <>.either + ..true_parser + ..false_parser)) (def: number_parser (Parser Number) @@ -354,8 +354,8 @@ [mark (<text>.one_of "eE") signed?' (<>.parses? (<text>.this "-")) offset (<text>.many <text>.decimal)] - (in ($_ text#composite mark (if signed?' "-" "") offset))))] - (case (f#decoded ($_ text#composite (if signed? "-" "") digits "." decimals exp)) + (in (all text#composite mark (if signed?' "-" "") offset))))] + (case (f#decoded (all text#composite (if signed? "-" "") digits "." decimals exp)) {try.#Failure message} (<>.failure message) @@ -364,21 +364,21 @@ (def: escaped_parser (Parser Text) - ($_ <>.either - (<>.after (<text>.this "\t") - (<>#in text.tab)) - (<>.after (<text>.this "\b") - (<>#in text.back_space)) - (<>.after (<text>.this "\n") - (<>#in text.new_line)) - (<>.after (<text>.this "\r") - (<>#in text.carriage_return)) - (<>.after (<text>.this "\f") - (<>#in text.form_feed)) - (<>.after (<text>.this (text#composite "\" text.double_quote)) - (<>#in text.double_quote)) - (<>.after (<text>.this "\\") - (<>#in "\")))) + (all <>.either + (<>.after (<text>.this "\t") + (<>#in text.tab)) + (<>.after (<text>.this "\b") + (<>#in text.back_space)) + (<>.after (<text>.this "\n") + (<>#in text.new_line)) + (<>.after (<text>.this "\r") + (<>#in text.carriage_return)) + (<>.after (<text>.this "\f") + (<>#in text.form_feed)) + (<>.after (<text>.this (text#composite "\" text.double_quote)) + (<>#in text.double_quote)) + (<>.after (<text>.this "\\") + (<>#in "\")))) (def: string_parser (Parser String) @@ -391,7 +391,7 @@ (do ! [escaped escaped_parser next_chars (again [])] - (in ($_ text#composite chars escaped next_chars))) + (in (all text#composite chars escaped next_chars))) (in chars)))) (def: (kv_parser json_parser) @@ -423,13 +423,13 @@ (Parser JSON) (<>.rec (function (_ json_parser) - ($_ <>.or - null_parser - boolean_parser - number_parser - string_parser - (array_parser json_parser) - (object_parser json_parser))))) + (all <>.or + null_parser + boolean_parser + number_parser + string_parser + (array_parser json_parser) + (object_parser json_parser))))) (implementation: .public codec (Codec Text JSON) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 0069ebb85..5e3c57155 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -353,46 +353,46 @@ (def: small_number (-> Size Size) - (|>> ($_ n.+ ..blank_size ..null_size))) + (|>> (all n.+ ..blank_size ..null_size))) (def: big_number (-> Size Size) - (|>> ($_ n.+ ..blank_size))) + (|>> (all n.+ ..blank_size))) (def: string (-> Size Size) - (|>> ($_ n.+ ..null_size))) + (|>> (all n.+ ..null_size))) (def: header_size - ($_ n.+ - ... name - (..string ..path_size) - ... mode - (..small_number ..mode_size) - ... uid - (..small_number ..owner_id_size) - ... gid - (..small_number ..owner_id_size) - ... size - (..big_number ..content_size) - ... mtime - (..big_number ..modification_time_size) - ... chksum - (..small_number ..checksum_size) - ... linkflag - ..link_flag_size - ... linkname - (..string ..path_size) - ... magic - (..string ..magic_size) - ... uname - (..string ..name_size) - ... gname - (..string ..name_size) - ... devmajor - (..small_number ..device_size) - ... devminor - (..small_number ..device_size))) + (all n.+ + ... name + (..string ..path_size) + ... mode + (..small_number ..mode_size) + ... uid + (..small_number ..owner_id_size) + ... gid + (..small_number ..owner_id_size) + ... size + (..big_number ..content_size) + ... mtime + (..big_number ..modification_time_size) + ... chksum + (..small_number ..checksum_size) + ... linkflag + ..link_flag_size + ... linkname + (..string ..path_size) + ... magic + (..string ..magic_size) + ... uname + (..string ..name_size) + ... gname + (..string ..name_size) + ... devmajor + (..small_number ..device_size) + ... devminor + (..small_number ..device_size))) (abstract: Link_Flag Char @@ -493,25 +493,25 @@ (def: maximum_mode Mode - ($_ and - ..none - - ..execute_by_other - ..write_by_other - ..read_by_other - - ..execute_by_group - ..write_by_group - ..read_by_group - - ..execute_by_owner - ..write_by_owner - ..read_by_owner - - ..save_text - ..set_group_id_on_execution - ..set_user_id_on_execution - )) + (all and + ..none + + ..execute_by_other + ..write_by_other + ..read_by_other + + ..execute_by_group + ..write_by_group + ..read_by_group + + ..execute_by_owner + ..write_by_owner + ..read_by_owner + + ..save_text + ..set_group_id_on_execution + ..set_user_id_on_execution + )) (def: mode_parser (Parser Mode) @@ -622,22 +622,22 @@ (def: header_writer' (Writer Header) - ($_ format.and - ..path_writer - ..mode_writer - ..small_writer - ..small_writer - ..big_writer - ..big_writer - ..checksum_writer - ..link_flag_writer - ..path_writer - ..magic_writer - ..name_writer - ..name_writer - ..small_writer - ..small_writer - )) + (all format.and + ..path_writer + ..mode_writer + ..small_writer + ..small_writer + ..big_writer + ..big_writer + ..checksum_writer + ..link_flag_writer + ..path_writer + ..magic_writer + ..name_writer + ..name_writer + ..small_writer + ..small_writer + )) (def: (header_writer header) (Writer Header) @@ -661,9 +661,9 @@ (-> Link_Flag (Writer File)) (function (_ [path modification_time mode ownership content]) (let [[size content] (..from_content content) - writer ($_ format.and - ..header_writer - (format.segment (..rounded_content_size size)))] + writer (all format.and + ..header_writer + (format.segment (..rounded_content_size size)))] (writer [[#path path #mode mode #user_id (the [#user #id] ownership) diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 30e75d6e6..d30f2aeee 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -46,13 +46,13 @@ (def: xml_standard_escape_char^ (Parser Text) - ($_ <>.either - (<>.after (<text>.this "<") (<>#in "<")) - (<>.after (<text>.this ">") (<>#in ">")) - (<>.after (<text>.this "&") (<>#in "&")) - (<>.after (<text>.this "'") (<>#in "'")) - (<>.after (<text>.this """) (<>#in text.double_quote)) - )) + (all <>.either + (<>.after (<text>.this "<") (<>#in "<")) + (<>.after (<text>.this ">") (<>#in ">")) + (<>.after (<text>.this "&") (<>#in "&")) + (<>.after (<text>.this "'") (<>#in "'")) + (<>.after (<text>.this """) (<>#in text.double_quote)) + )) (def: xml_unicode_escape_char^ (Parser Text) @@ -78,17 +78,17 @@ (def: xml_char^ (Parser Text) - (<>.either (<text>.none_of ($_ text#composite "<>&" text.double_quote)) + (<>.either (<text>.none_of (all text#composite "<>&" text.double_quote)) xml_escape_char^)) (def: xml_identifier (Parser Text) (<text>.slice - ($_ <text>.and! - (<>.either (<text>.one_of! "_") - <text>.alpha!) - (<text>.some! (<>.either (<text>.one_of! "_.-") - <text>.alpha_num!))))) + (all <text>.and! + (<>.either (<text>.one_of! "_") + <text>.alpha!) + (<text>.some! (<>.either (<text>.one_of! "_.-") + <text>.alpha_num!))))) (def: namespaced_symbol^ (Parser Symbol) @@ -132,9 +132,9 @@ ..spaced^ (<>.after (<text>.this "/")) (<text>.enclosed ["<" ">"]))] - (<>.assertion ($_ text#composite "Close tag does not match open tag." \n - "Expected: " (symbol#encoded expected) \n - " Actual: " (symbol#encoded actual) \n) + (<>.assertion (all text#composite "Close tag does not match open tag." \n + "Expected: " (symbol#encoded expected) \n + " Actual: " (symbol#encoded actual) \n) (symbol#= expected actual)))) (def: comment^ @@ -177,24 +177,24 @@ [_ (<text>.this "<") tag (..spaced^ tag^) attrs (..spaced^ attrs^) - .let [no_children^ ($_ <>.either - (do <>.monad - [_ (<text>.this "/>")] - (in {#Node tag attrs (list)})) - (do <>.monad - [_ (<text>.this ">") - _ (<>.some (<>.either <text>.space! - ..comment^)) - _ (..close_tag^ tag)] - (in {#Node tag attrs (list)}))) + .let [no_children^ (all <>.either + (do <>.monad + [_ (<text>.this "/>")] + (in {#Node tag attrs (list)})) + (do <>.monad + [_ (<text>.this ">") + _ (<>.some (<>.either <text>.space! + ..comment^)) + _ (..close_tag^ tag)] + (in {#Node tag attrs (list)}))) with_children^ (do <>.monad [_ (<text>.this ">") children (<>.many node^) _ (..close_tag^ tag)] (in {#Node tag attrs children}))]] - ($_ <>.either - no_children^ - with_children^)) + (all <>.either + no_children^ + with_children^)) ..spaced^ (<>.before (<>.some ..comment^)) (<>.after (<>.some ..comment^)) @@ -215,7 +215,7 @@ (-> Tag Text) (case namespace "" name - _ ($_ text#composite namespace ..namespace_separator name))) + _ (all text#composite namespace ..namespace_separator name))) (def: .public attribute (-> Attribute Text) @@ -225,12 +225,12 @@ Text (let [quote (is (-> Text Text) (function (_ value) - ($_ text#composite text.double_quote value text.double_quote)))] - ($_ text#composite - "<?xml" - " version=" (quote "1.0") - " encoding=" (quote "UTF-8") - "?>"))) + (all text#composite text.double_quote value text.double_quote)))] + (all text#composite + "<?xml" + " version=" (quote "1.0") + " encoding=" (quote "UTF-8") + "?>"))) (implementation: .public codec (Codec Text XML) @@ -241,40 +241,40 @@ (|> attrs dictionary.entries (list#each (function (_ [key value]) - ($_ text#composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote))) + (all text#composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote))) (text.interposed " "))))] (function (_ input) - ($_ text#composite - ..xml_header text.new_line - (loop (again [prefix "" - input input]) - (case input - {#Text value} - (sanitize_value value) - - (pattern {#Node xml_tag xml_attrs (list {#Text value})}) - (let [tag (..tag xml_tag) - attrs (if (dictionary.empty? xml_attrs) - "" - ($_ text#composite " " (attributes xml_attrs)))] - ($_ text#composite - prefix "<" tag attrs ">" - (sanitize_value value) - "</" tag ">")) - - {#Node xml_tag xml_attrs xml_children} - (let [tag (..tag xml_tag) - attrs (if (dictionary.empty? xml_attrs) - "" - ($_ text#composite " " (attributes xml_attrs)))] - (if (list.empty? xml_children) - ($_ text#composite prefix "<" tag attrs "/>") - ($_ text#composite prefix "<" tag attrs ">" - (|> xml_children - (list#each (|>> (again (text#composite prefix text.tab)) (text#composite text.new_line))) - text.together) - text.new_line prefix "</" tag ">"))))) - )))) + (all text#composite + ..xml_header text.new_line + (loop (again [prefix "" + input input]) + (case input + {#Text value} + (sanitize_value value) + + (pattern {#Node xml_tag xml_attrs (list {#Text value})}) + (let [tag (..tag xml_tag) + attrs (if (dictionary.empty? xml_attrs) + "" + (all text#composite " " (attributes xml_attrs)))] + (all text#composite + prefix "<" tag attrs ">" + (sanitize_value value) + "</" tag ">")) + + {#Node xml_tag xml_attrs xml_children} + (let [tag (..tag xml_tag) + attrs (if (dictionary.empty? xml_attrs) + "" + (all text#composite " " (attributes xml_attrs)))] + (if (list.empty? xml_children) + (all text#composite prefix "<" tag attrs "/>") + (all text#composite prefix "<" tag attrs ">" + (|> xml_children + (list#each (|>> (again (text#composite prefix text.tab)) (text#composite text.new_line))) + text.together) + text.new_line prefix "</" tag ">"))))) + )))) (def: decoded (<text>.result ..xml^))) diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux index 6f4743a46..f516c7d97 100644 --- a/stdlib/source/library/lux/data/product.lux +++ b/stdlib/source/library/lux/data/product.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" left right} [abstract [equivalence {"+" Equivalence}] [hash {"+" Hash}]]]]) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index c2b3d7512..5d1fe365b 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" left right} [abstract [equivalence {"+" Equivalence}] [hash {"+" Hash}]]]]) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 7f530a137..22ee37a50 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -122,7 +122,7 @@ (def: .public (enclosed [left right] content) (-> [Text Text] Text Text) - ($_ "lux text concat" left content right)) + (all "lux text concat" left content right)) (def: .public (enclosed' boundary content) (-> Text Text Text) @@ -182,7 +182,7 @@ (<| (maybe.else template) (do maybe.monad [[pre post] (..split_by pattern template)] - (in ($_ "lux text concat" pre replacement post))))) + (in (all "lux text concat" pre replacement post))))) (for @.js (these (macro: (defined? tokens lux) (case tokens @@ -216,7 +216,7 @@ right template]) (case (..split_by pattern right) {.#Some [pre post]} - (again ($_ "lux text concat" left pre replacement) post) + (again (all "lux text concat" left pre replacement) post) {.#None} ("lux text concat" left right)))] diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux index ee3f8ddc5..5b719d954 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -49,7 +49,7 @@ (|>> f fb))) (syntax: .public (format [fragments (<>.many <code>.any)]) - (in (.list (` ($_ "lux text concat" (~+ fragments)))))) + (in (.list (` (all "lux text concat" (~+ fragments)))))) (template [<name> <type> <formatter>] [(def: .public <name> diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index c24c0093f..1b784bebe 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -3,7 +3,7 @@ [lux {"-" pattern} ["[0]" meta] [abstract - monad] + [monad {"+" do}]] [control ["[0]" maybe] ["[0]" try] @@ -71,11 +71,11 @@ (def: (symbol^ current_module) (-> Text (Parser Symbol)) - ($_ <>.either - (<>.and (<>#in current_module) (<>.after (<text>.this "..") symbol_part^)) - (<>.and symbol_part^ (<>.after (<text>.this ".") symbol_part^)) - (<>.and (<>#in .prelude_module) (<>.after (<text>.this ".") symbol_part^)) - (<>.and (<>#in "") symbol_part^))) + (all <>.either + (<>.and (<>#in current_module) (<>.after (<text>.this "..") symbol_part^)) + (<>.and symbol_part^ (<>.after (<text>.this ".") symbol_part^)) + (<>.and (<>#in .prelude_module) (<>.after (<text>.this ".") symbol_part^)) + (<>.and (<>#in "") symbol_part^))) (def: (re_var^ current_module) (-> Text (Parser Code)) @@ -107,12 +107,12 @@ (Parser Code) (do <>.monad [negate? (<>.maybe (<text>.this "^")) - parts (<>.many ($_ <>.either - re_range^ - re_options^))] + parts (<>.many (all <>.either + re_range^ + re_options^))] (in (case negate? - {.#Some _} (` ((~! <text>.not) ($_ ((~! <>.either)) (~+ parts)))) - {.#None} (` ($_ ((~! <>.either)) (~+ parts))))))) + {.#Some _} (` ((~! <text>.not) (all ((~! <>.either)) (~+ parts)))) + {.#None} (` (all ((~! <>.either)) (~+ parts))))))) (def: re_user_class^ (Parser Code) @@ -157,30 +157,30 @@ (Parser Code) (do <>.monad [] - ($_ <>.either - (<>.after (<text>.this ".") (in (` (~! <text>.any)))) - (<>.after (<text>.this "\d") (in (` (~! <text>.decimal)))) - (<>.after (<text>.this "\D") (in (` ((~! <text>.not) (~! <text>.decimal))))) - (<>.after (<text>.this "\s") (in (` (~! <text>.space)))) - (<>.after (<text>.this "\S") (in (` ((~! <text>.not) (~! <text>.space))))) - (<>.after (<text>.this "\w") (in (` (~! word^)))) - (<>.after (<text>.this "\W") (in (` ((~! <text>.not) (~! word^))))) - - (<>.after (<text>.this "\p{Lower}") (in (` (~! <text>.lower)))) - (<>.after (<text>.this "\p{Upper}") (in (` (~! <text>.upper)))) - (<>.after (<text>.this "\p{Alpha}") (in (` (~! <text>.alpha)))) - (<>.after (<text>.this "\p{Digit}") (in (` (~! <text>.decimal)))) - (<>.after (<text>.this "\p{Alnum}") (in (` (~! <text>.alpha_num)))) - (<>.after (<text>.this "\p{Space}") (in (` (~! <text>.space)))) - (<>.after (<text>.this "\p{HexDigit}") (in (` (~! <text>.hexadecimal)))) - (<>.after (<text>.this "\p{OctDigit}") (in (` (~! <text>.octal)))) - (<>.after (<text>.this "\p{Blank}") (in (` (~! blank^)))) - (<>.after (<text>.this "\p{ASCII}") (in (` (~! ascii^)))) - (<>.after (<text>.this "\p{Contrl}") (in (` (~! control^)))) - (<>.after (<text>.this "\p{Punct}") (in (` (~! punct^)))) - (<>.after (<text>.this "\p{Graph}") (in (` (~! graph^)))) - (<>.after (<text>.this "\p{Print}") (in (` (~! print^)))) - ))) + (all <>.either + (<>.after (<text>.this ".") (in (` (~! <text>.any)))) + (<>.after (<text>.this "\d") (in (` (~! <text>.decimal)))) + (<>.after (<text>.this "\D") (in (` ((~! <text>.not) (~! <text>.decimal))))) + (<>.after (<text>.this "\s") (in (` (~! <text>.space)))) + (<>.after (<text>.this "\S") (in (` ((~! <text>.not) (~! <text>.space))))) + (<>.after (<text>.this "\w") (in (` (~! word^)))) + (<>.after (<text>.this "\W") (in (` ((~! <text>.not) (~! word^))))) + + (<>.after (<text>.this "\p{Lower}") (in (` (~! <text>.lower)))) + (<>.after (<text>.this "\p{Upper}") (in (` (~! <text>.upper)))) + (<>.after (<text>.this "\p{Alpha}") (in (` (~! <text>.alpha)))) + (<>.after (<text>.this "\p{Digit}") (in (` (~! <text>.decimal)))) + (<>.after (<text>.this "\p{Alnum}") (in (` (~! <text>.alpha_num)))) + (<>.after (<text>.this "\p{Space}") (in (` (~! <text>.space)))) + (<>.after (<text>.this "\p{HexDigit}") (in (` (~! <text>.hexadecimal)))) + (<>.after (<text>.this "\p{OctDigit}") (in (` (~! <text>.octal)))) + (<>.after (<text>.this "\p{Blank}") (in (` (~! blank^)))) + (<>.after (<text>.this "\p{ASCII}") (in (` (~! ascii^)))) + (<>.after (<text>.this "\p{Contrl}") (in (` (~! control^)))) + (<>.after (<text>.this "\p{Punct}") (in (` (~! punct^)))) + (<>.after (<text>.this "\p{Graph}") (in (` (~! graph^)))) + (<>.after (<text>.this "\p{Print}") (in (` (~! print^)))) + ))) (def: re_class^ (Parser Code) @@ -206,12 +206,12 @@ (def: (re_simple^ current_module) (-> Text (Parser Code)) - ($_ <>.either - re_class^ - (re_var^ current_module) - re_back_reference^ - re_char^ - )) + (all <>.either + re_class^ + (re_var^ current_module) + re_back_reference^ + re_char^ + )) (def: (re_simple_quantified^ current_module) (-> Text (Parser Code)) @@ -241,24 +241,24 @@ (do [! <>.monad] [base (re_simple^ current_module)] (<| (<text>.enclosed ["{" "}"]) - ($_ <>.either - (do ! - [[from to] (<>.and number^ (<>.after (<text>.this ",") number^)) - _ (<>.assertion (exception.error ..incorrect_quantification [from to]) - (n.<= to from))] - (in (` ((~! together^) ((~! <>.between) - (~ (code.nat from)) - (~ (code.nat (n.- from to))) - (~ base)))))) - (do ! - [limit (<>.after (<text>.this ",") number^)] - (in (` ((~! together^) ((~! <>.at_most) (~ (code.nat limit)) (~ base)))))) - (do ! - [limit (<>.before (<text>.this ",") number^)] - (in (` ((~! together^) ((~! <>.at_least) (~ (code.nat limit)) (~ base)))))) - (do ! - [limit number^] - (in (` ((~! together^) ((~! <>.exactly) (~ (code.nat limit)) (~ base)))))))))) + (all <>.either + (do ! + [[from to] (<>.and number^ (<>.after (<text>.this ",") number^)) + _ (<>.assertion (exception.error ..incorrect_quantification [from to]) + (n.<= to from))] + (in (` ((~! together^) ((~! <>.between) + (~ (code.nat from)) + (~ (code.nat (n.- from to))) + (~ base)))))) + (do ! + [limit (<>.after (<text>.this ",") number^)] + (in (` ((~! together^) ((~! <>.at_most) (~ (code.nat limit)) (~ base)))))) + (do ! + [limit (<>.before (<text>.this ",") number^)] + (in (` ((~! together^) ((~! <>.at_least) (~ (code.nat limit)) (~ base)))))) + (do ! + [limit number^] + (in (` ((~! together^) ((~! <>.exactly) (~ (code.nat limit)) (~ base)))))))))) (def: (re_quantified^ current_module) (-> Text (Parser Code)) @@ -267,9 +267,9 @@ (def: (re_complex^ current_module) (-> Text (Parser Code)) - ($_ <>.either - (re_quantified^ current_module) - (re_simple^ current_module))) + (all <>.either + (re_quantified^ current_module) + (re_simple^ current_module))) (type: Re_Group (Variant @@ -380,35 +380,35 @@ (if (list.empty? tail) (in head) (in [(list#mix n.max (product.left head) (list#each product.left tail)) - (` ($_ ((~ (if capturing? - (` (~! |||^)) - (` (~! |||_^))))) - (~ (prep_alternative head)) - (~+ (list#each prep_alternative tail))))])))) + (` (all ((~ (if capturing? + (` (~! |||^)) + (` (~! |||_^))))) + (~ (prep_alternative head)) + (~+ (list#each prep_alternative tail))))])))) (def: (re_scoped^ current_module) (-> Text (Parser [Re_Group Code])) - ($_ <>.either - (do <>.monad - [_ (<text>.this "(?:") - [_ scoped] (re_alternative^ #0 re_scoped^ current_module) - _ (<text>.this ")")] - (in [{#Non_Capturing} scoped])) - (do <>.monad - [complex (re_complex^ current_module)] - (in [{#Non_Capturing} complex])) - (do <>.monad - [_ (<text>.this "(?<") - captured_symbol symbol_part^ - _ (<text>.this ">") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) - _ (<text>.this ")")] - (in [{#Capturing [{.#Some captured_symbol} num_captures]} pattern])) - (do <>.monad - [_ (<text>.this "(") - [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) - _ (<text>.this ")")] - (in [{#Capturing [{.#None} num_captures]} pattern])))) + (all <>.either + (do <>.monad + [_ (<text>.this "(?:") + [_ scoped] (re_alternative^ #0 re_scoped^ current_module) + _ (<text>.this ")")] + (in [{#Non_Capturing} scoped])) + (do <>.monad + [complex (re_complex^ current_module)] + (in [{#Non_Capturing} complex])) + (do <>.monad + [_ (<text>.this "(?<") + captured_symbol symbol_part^ + _ (<text>.this ">") + [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + _ (<text>.this ")")] + (in [{#Capturing [{.#Some captured_symbol} num_captures]} pattern])) + (do <>.monad + [_ (<text>.this "(") + [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) + _ (<text>.this ")")] + (in [{#Capturing [{.#None} num_captures]} pattern])))) (def: (regex^ current_module) (-> Text (Parser Code)) diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index df7afedc8..29552979a 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -152,11 +152,11 @@ (def: .public character Set - ($_ ..composite - ..character/0 - ..character/1 - ..character/2 - )) + (all ..composite + ..character/0 + ..character/1 + ..character/2 + )) (def: .public non_character Set @@ -195,10 +195,10 @@ (def: .public full Set - ($_ ..composite - ..character - ..non_character - )) + (all ..composite + ..character + ..non_character + )) (def: .public start (-> Set Char) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index d5ed1cff8..e1729e2ad 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -389,58 +389,58 @@ (def: primitive_representation (Parser Representation) - (`` ($_ <>.either - (do <>.monad - [_ (<type>.exactly Any)] - (in (function.constant "[]"))) - - (~~ (template [<type> <formatter>] - [(do <>.monad - [_ (<type>.sub <type>)] - (in (|>> (as <type>) <formatter>)))] - - [Bit %.bit] - [Nat %.nat] - [Int %.int] - [Rev %.rev] - [Frac %.frac] - [Text %.text])) - ))) + (`` (all <>.either + (do <>.monad + [_ (<type>.exactly Any)] + (in (function.constant "[]"))) + + (~~ (template [<type> <formatter>] + [(do <>.monad + [_ (<type>.sub <type>)] + (in (|>> (as <type>) <formatter>)))] + + [Bit %.bit] + [Nat %.nat] + [Int %.int] + [Rev %.rev] + [Frac %.frac] + [Text %.text])) + ))) (def: (special_representation representation) (-> (Parser Representation) (Parser Representation)) - (`` ($_ <>.either - (~~ (template [<type> <formatter>] - [(do <>.monad - [_ (<type>.sub <type>)] - (in (|>> (as <type>) <formatter>)))] - - [Ratio %.ratio] - [Symbol %.symbol] - [Location %.location] - [Type %.type] - [Code %.code] - - [Instant %.instant] - [Duration %.duration] - [Date %.date] - [Time %.time] - [Month %.month] - [Day %.day] - - [json.JSON %.json] - [XML %.xml])) - - (do <>.monad - [[_ elemT] (<type>.applied (<>.and (<type>.exactly List) <type>.any)) - elemR (<type>.local (list elemT) representation)] - (in (|>> (as (List Any)) (%.list elemR)))) - - (do <>.monad - [[_ elemT] (<type>.applied (<>.and (<type>.exactly Maybe) <type>.any)) - elemR (<type>.local (list elemT) representation)] - (in (|>> (as (Maybe Any)) - (%.maybe elemR))))))) + (`` (all <>.either + (~~ (template [<type> <formatter>] + [(do <>.monad + [_ (<type>.sub <type>)] + (in (|>> (as <type>) <formatter>)))] + + [Ratio %.ratio] + [Symbol %.symbol] + [Location %.location] + [Type %.type] + [Code %.code] + + [Instant %.instant] + [Duration %.duration] + [Date %.date] + [Time %.time] + [Month %.month] + [Day %.day] + + [json.JSON %.json] + [XML %.xml])) + + (do <>.monad + [[_ elemT] (<type>.applied (<>.and (<type>.exactly List) <type>.any)) + elemR (<type>.local (list elemT) representation)] + (in (|>> (as (List Any)) (%.list elemR)))) + + (do <>.monad + [[_ elemT] (<type>.applied (<>.and (<type>.exactly Maybe) <type>.any)) + elemR (<type>.local (list elemT) representation)] + (in (|>> (as (Maybe Any)) + (%.maybe elemR))))))) (def: (variant_representation representation) (-> (Parser Representation) (Parser Representation)) @@ -491,27 +491,27 @@ (Parser Representation) (<>.rec (function (_ representation) - ($_ <>.either - ..primitive_representation - (..special_representation representation) - (..variant_representation representation) - (..tuple_representation representation) - - (do <>.monad - [[funcT inputsT+] (<type>.applied (<>.and <type>.any (<>.many <type>.any)))] - (case (type.applied inputsT+ funcT) - {.#Some outputT} - (<type>.local (list outputT) representation) - - {.#None} - (<>.failure ""))) - - (do <>.monad - [[name anonymous] <type>.named] - (<type>.local (list anonymous) representation)) - - (<>.failure "") - )))) + (all <>.either + ..primitive_representation + (..special_representation representation) + (..variant_representation representation) + (..tuple_representation representation) + + (do <>.monad + [[funcT inputsT+] (<type>.applied (<>.and <type>.any (<>.many <type>.any)))] + (case (type.applied inputsT+ funcT) + {.#Some outputT} + (<type>.local (list outputT) representation) + + {.#None} + (<>.failure ""))) + + (do <>.monad + [[name anonymous] <type>.named] + (<type>.local (list anonymous) representation)) + + (<>.failure "") + )))) (def: .public (representation type value) (-> Type Any (Try Text)) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index 37b462ea8..c50a1070a 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -506,35 +506,35 @@ tags (meta.tags_of name)] (with_expansions [<\n> (~! text.\n)] (macro.with_symbols [g!type] - (in (list (` ($_ ((~! md.then)) - ... Name - (<| ((~! md.heading/3)) - (~ (code.text (%.code (let [g!name (|> name product.right code.local)] - (case parameters - {.#End} - g!name - - _ - (` ((~ g!name) (~+ (list#each code.local parameters)))))))))) - ... Type - (let [(~ g!type) ("lux in-module" - (~ g!module) - (.type_of (~ (code.symbol name))))] - ((~! md.code) "clojure" - (~ (if (type#= .Type def_type) - (` (|> (~ (code.symbol name)) - (as .Type) - ((~! type.anonymous)) - ((~! ..type_definition) - (~ g!module) - [(~ (code.text (product.right name))) (list (~+ (list#each code.text parameters)))] - (.list (~+ (|> tags - (maybe.else (list)) - (list#each (|>> product.right code.text)))))) - ((~! %.format) - ((~! ..single_line_comment) ((~! ..type) (~ g!module) (~ g!type))) - <\n>))) - (` ((~! ..type) (~ g!module) (~ g!type)))))))) + (in (list (` (all ((~! md.then)) + ... Name + (<| ((~! md.heading/3)) + (~ (code.text (%.code (let [g!name (|> name product.right code.local)] + (case parameters + {.#End} + g!name + + _ + (` ((~ g!name) (~+ (list#each code.local parameters)))))))))) + ... Type + (let [(~ g!type) ("lux in-module" + (~ g!module) + (.type_of (~ (code.symbol name))))] + ((~! md.code) "clojure" + (~ (if (type#= .Type def_type) + (` (|> (~ (code.symbol name)) + (as .Type) + ((~! type.anonymous)) + ((~! ..type_definition) + (~ g!module) + [(~ (code.text (product.right name))) (list (~+ (list#each code.text parameters)))] + (.list (~+ (|> tags + (maybe.else (list)) + (list#each (|>> product.right code.text)))))) + ((~! %.format) + ((~! ..single_line_comment) ((~! ..type) (~ g!module) (~ g!type))) + <\n>))) + (` ((~! ..type) (~ g!module) (~ g!type)))))))) ))))))) (syntax: (definition_documentation @@ -542,30 +542,30 @@ description ..description examples (<>.some ..example)]) (with_expansions [<\n> (~! text.\n)] - (in (list (` ($_ ((~! md.then)) - ((~! ..minimal_definition_documentation) - ((~ (code.symbol name)) - (~+ (list#each code.local parameters)))) - ... Description - (~+ (case description - {.#Some description} - (list (` (<| ((~! md.paragraph)) - ((~! md.text)) - (~ description)))) - - {.#None} - (list))) - ... Examples - (~+ (case examples - {.#End} - (list) - - _ - (list (` (<| ((~! md.code) "clojure") - ((~! %.format) - (~+ (|> examples - (list#each (..example_documentation (product.left name))) - (list.interposed ..example_separator)))))))))) + (in (list (` (all ((~! md.then)) + ((~! ..minimal_definition_documentation) + ((~ (code.symbol name)) + (~+ (list#each code.local parameters)))) + ... Description + (~+ (case description + {.#Some description} + (list (` (<| ((~! md.paragraph)) + ((~! md.text)) + (~ description)))) + + {.#None} + (list))) + ... Examples + (~+ (case examples + {.#End} + (list) + + _ + (list (` (<| ((~! md.code) "clojure") + ((~! %.format) + (~+ (|> examples + (list#each (..example_documentation (product.left name))) + (list.interposed ..example_separator)))))))))) ))))) (type: .public Definition @@ -638,10 +638,10 @@ (list#each product.left) ..expected_format)))) ..#definitions ((~! list.together) (list (~+ definitions)))] - ($_ (# (~! list.monoid) (~' composite)) - (is (List Module) - (# (~! list.monoid) (~' identity))) - (~+ subs))))))))) + (all (# (~! list.monoid) (~' composite)) + (is (List Module) + (# (~! list.monoid) (~' identity))) + (~+ subs))))))))) (def: listing (-> (List Text) (Markdown Block)) @@ -654,51 +654,51 @@ (def: (module_documentation module) (-> Module (Markdown Block)) (let [(open "_[0]") module] - ($_ md.then - ... Name - (md.heading/1 (the #module module)) - ... Description - (case (the #description module) - "" md.empty - description (<| md.paragraph - md.text - description)) - ... Definitions - (md.heading/2 "Definitions") - (|> module - (the #definitions) - (list.only (|>> (the #definition) - (set.member? _#expected))) - ..definitions_documentation) - ... Missing documentation - (case (|> module - (the #definitions) - (list#mix (function (_ definition missing) - (set.lacks (the #definition definition) missing)) - _#expected) - set.list) - {.#End} - md.empty - - missing - ($_ md.then - (md.heading/2 "Missing documentation") - (..listing missing))) - ... Un-expected documentation - (case (|> module - (the #definitions) - (list.only (|>> (the #definition) - (set.member? _#expected) - not)) - (list#each (the #definition))) - {.#End} - md.empty - - un_expected - ($_ md.then - (md.heading/2 "Un-expected documentation") - (..listing un_expected))) - ))) + (all md.then + ... Name + (md.heading/1 (the #module module)) + ... Description + (case (the #description module) + "" md.empty + description (<| md.paragraph + md.text + description)) + ... Definitions + (md.heading/2 "Definitions") + (|> module + (the #definitions) + (list.only (|>> (the #definition) + (set.member? _#expected))) + ..definitions_documentation) + ... Missing documentation + (case (|> module + (the #definitions) + (list#mix (function (_ definition missing) + (set.lacks (the #definition definition) missing)) + _#expected) + set.list) + {.#End} + md.empty + + missing + (all md.then + (md.heading/2 "Missing documentation") + (..listing missing))) + ... Un-expected documentation + (case (|> module + (the #definitions) + (list.only (|>> (the #definition) + (set.member? _#expected) + not)) + (list#each (the #definition))) + {.#End} + md.empty + + un_expected + (all md.then + (md.heading/2 "Un-expected documentation") + (..listing un_expected))) + ))) (def: .public documentation (-> (List Module) Text) diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index b41d45138..bca5494f8 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -29,12 +29,12 @@ (def: (declaration default) (-> Code (Parser Declaration)) - (<c>.form ($_ <>.and - <c>.any - <c>.local - <c>.local - <c>.local - (<c>.tuple (<>.some <c>.any))))) + (<c>.form (all <>.and + <c>.any + <c>.local + <c>.local + <c>.local + (<c>.tuple (<>.some <c>.any))))) (template [<any> <end> <and> <result> <extension> <name>] [(syntax: .public (<name> [[name extension phase archive inputs] (..declaration (` <any>)) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index aff9bb6e9..000d80023 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -424,7 +424,7 @@ (do <>.monad [.let [dotted_name (format "::" field_name)] [_ _ value] (.is (Parser [Any Any Code]) - (<code>.form ($_ <>.and (<code>.this (' :=)) (<code>.this (code.symbol ["" dotted_name])) <code>.any)))] + (<code>.form (all <>.and (<code>.this (' :=)) (<code>.this (code.symbol ["" dotted_name])) <code>.any)))] (in (`' ("jvm member put virtual" (~ (code.text class_name)) (~ (code.text field_name)) @@ -535,19 +535,19 @@ (def: privacy_modifier^ (Parser Privacy) (let [(open "[0]") <>.monad] - ($_ <>.or - (<code>.this (' "public")) - (<code>.this (' "private")) - (<code>.this (' "protected")) - (in [])))) + (all <>.or + (<code>.this (' "public")) + (<code>.this (' "private")) + (<code>.this (' "protected")) + (in [])))) (def: inheritance_modifier^ (Parser Inheritance) (let [(open "[0]") <>.monad] - ($_ <>.or - (<code>.this (' "final")) - (<code>.this (' "abstract")) - (in [])))) + (all <>.or + (<code>.this (' "final")) + (<code>.this (' "abstract")) + (in [])))) (exception: .public (class_names_cannot_contain_periods [name Text]) (exception.report @@ -582,9 +582,9 @@ (do <>.monad [.let [class_name^ (..valid_class_name type_vars)] [name parameters] (.is (Parser [External (List (Type Parameter))]) - ($_ <>.either - (<>.and class_name^ (<>#in (list))) - (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] + (all <>.either + (<>.and class_name^ (<>#in (list))) + (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] (in (jvm.class (name.safe name) parameters)))) (exception: .public (unknown_type_variable [name Text @@ -624,13 +624,13 @@ (<>.rec (function (_ _) (let [class^ (..class^' parameter^ type_vars)] - ($_ <>.either - (..type_variable type_vars) - ..wildcard^ - (upper^ class^) - (lower^ class^) - class^ - ))))) + (all <>.either + (..type_variable type_vars) + ..wildcard^ + (upper^ class^) + (lower^ class^) + class^ + ))))) (def: (itself^ type) (All (_ category) @@ -642,16 +642,16 @@ (def: primitive^ (Parser (Type Primitive)) - ($_ <>.either - (itself^ jvm.boolean) - (itself^ jvm.byte) - (itself^ jvm.short) - (itself^ jvm.int) - (itself^ jvm.long) - (itself^ jvm.float) - (itself^ jvm.double) - (itself^ jvm.char) - )) + (all <>.either + (itself^ jvm.boolean) + (itself^ jvm.byte) + (itself^ jvm.short) + (itself^ jvm.int) + (itself^ jvm.long) + (itself^ jvm.float) + (itself^ jvm.double) + (itself^ jvm.char) + )) (def: array^ (-> (Parser (Type Value)) (Parser (Type Array))) @@ -662,11 +662,11 @@ (-> (List (Type Var)) (Parser (Type Value))) (<>.rec (function (_ type^) - ($_ <>.either - ..primitive^ - (..parameter^ type_vars) - (..array^ type^) - )))) + (all <>.either + ..primitive^ + (..parameter^ type_vars) + (..array^ type^) + )))) (def: void^ (Parser (Type Void)) @@ -745,10 +745,10 @@ (def: state_modifier^ (Parser State) - ($_ <>.or - (<code>.this (' "volatile")) - (<code>.this (' "final")) - (# <>.monad in []))) + (all <>.or + (<code>.this (' "volatile")) + (<code>.this (' "final")) + (# <>.monad in []))) (def: (field_decl^ type_vars) (-> (List (Type Var)) (Parser [Member_Declaration FieldDecl])) @@ -792,10 +792,10 @@ strict_fp? (<>.parses? (<code>.this_text "strict")) method_vars (<>.else (list) ..vars^) .let [total_vars (list#composite class_vars method_vars)] - [_ self_name arguments] (<code>.form ($_ <>.and - (<code>.this (' new)) - <code>.local - (..arguments^ total_vars))) + [_ self_name arguments] (<code>.form (all <>.and + (<code>.this (' new)) + <code>.local + (..arguments^ total_vars))) constructor_args (..constructor_args^ total_vars) exs (throws_decl^ total_vars) annotations ..annotations^ @@ -813,10 +813,10 @@ final? (<>.parses? (<code>.this (' "final"))) method_vars (<>.else (list) ..vars^) .let [total_vars (list#composite class_vars method_vars)] - [name self_name arguments] (<code>.form ($_ <>.and - <code>.local - <code>.local - (..arguments^ total_vars))) + [name self_name arguments] (<code>.form (all <>.and + <code>.local + <code>.local + (..arguments^ total_vars))) return_type (..return^ total_vars) exs (throws_decl^ total_vars) annotations ..annotations^ @@ -834,10 +834,10 @@ method_vars (<>.else (list) ..vars^) .let [total_vars (list#composite (product.right (parser.declaration owner_class)) method_vars)] - [name self_name arguments] (<code>.form ($_ <>.and - <code>.local - <code>.local - (..arguments^ total_vars))) + [name self_name arguments] (<code>.form (all <>.and + <code>.local + <code>.local + (..arguments^ total_vars))) return_type (..return^ total_vars) exs (throws_decl^ total_vars) annotations ..annotations^ @@ -902,13 +902,13 @@ (def: (method_def^ class_vars) (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition])) - ($_ <>.either - (..constructor_method^ class_vars) - (..virtual_method_def^ class_vars) - ..overriden_method_def^ - ..static_method_def^ - ..abstract_method_def^ - ..native_method_def^)) + (all <>.either + (..constructor_method^ class_vars) + (..virtual_method_def^ class_vars) + ..overriden_method_def^ + ..static_method_def^ + ..abstract_method_def^ + ..native_method_def^)) (def: partial_call^ (Parser Partial_Call) @@ -927,10 +927,10 @@ (def: import_member_return_flags^ (Parser [Bit Bit Bit]) - ($_ <>.and - (<>.parses? (<code>.this (' "io"))) - (<>.parses? (<code>.this (' "try"))) - (<>.parses? (<code>.this (' "?"))))) + (all <>.and + (<>.parses? (<code>.this (' "io"))) + (<>.parses? (<code>.this (' "try"))) + (<>.parses? (<code>.this (' "?"))))) (def: primitive_mode^ (Parser Primitive_Mode) @@ -939,65 +939,65 @@ (def: (import_member_decl^ owner_vars) (-> (List (Type Var)) (Parser Import_Member_Declaration)) - ($_ <>.either - (<code>.form (do <>.monad - [_ (<code>.this (' "enum")) - enum_members (<>.some <code>.local)] - (in {#EnumDecl enum_members}))) - (<code>.form (do <>.monad - [tvars (<>.else (list) ..vars^) - _ (<code>.this_symbol ["" "new"]) - ?alias import_member_alias^ - .let [total_vars (list#composite owner_vars tvars)] - ?prim_mode (<>.maybe primitive_mode^) - args (..import_member_args^ total_vars) - [io? try? maybe?] import_member_return_flags^] - (in {#ConstructorDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_member_alias (maybe.else "new" ?alias) - #import_member_kind {#VirtualIMK} - #import_member_tvars tvars - #import_member_args args - #import_member_maybe? maybe? - #import_member_try? try? - #import_member_io? io?] - []]}) - )) - (<code>.form (do <>.monad - [kind (.is (Parser ImportMethodKind) - (<>.or (<code>.this (' "static")) - (in []))) - tvars (<>.else (list) ..vars^) - name <code>.local - ?alias import_member_alias^ - .let [total_vars (list#composite owner_vars tvars)] - ?prim_mode (<>.maybe primitive_mode^) - args (..import_member_args^ total_vars) - [io? try? maybe?] import_member_return_flags^ - return (..return^ total_vars)] - (in {#MethodDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_member_alias (maybe.else name ?alias) - #import_member_kind kind - #import_member_tvars tvars - #import_member_args args - #import_member_maybe? maybe? - #import_member_try? try? - #import_member_io? io?] - [#import_method_name name - #import_method_return return]]}))) - (<code>.form (do <>.monad - [static? (<>.parses? (<code>.this (' "static"))) - name <code>.local - ?prim_mode (<>.maybe primitive_mode^) - gtype (..type^ owner_vars) - maybe? (<>.parses? (<code>.this (' "?"))) - setter? (<>.parses? (<code>.this (' #!)))] - (in {#FieldAccessDecl [#import_field_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_field_name name - #import_field_static? static? - #import_field_maybe? maybe? - #import_field_setter? setter? - #import_field_type gtype]}))) - )) + (all <>.either + (<code>.form (do <>.monad + [_ (<code>.this (' "enum")) + enum_members (<>.some <code>.local)] + (in {#EnumDecl enum_members}))) + (<code>.form (do <>.monad + [tvars (<>.else (list) ..vars^) + _ (<code>.this_symbol ["" "new"]) + ?alias import_member_alias^ + .let [total_vars (list#composite owner_vars tvars)] + ?prim_mode (<>.maybe primitive_mode^) + args (..import_member_args^ total_vars) + [io? try? maybe?] import_member_return_flags^] + (in {#ConstructorDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_member_alias (maybe.else "new" ?alias) + #import_member_kind {#VirtualIMK} + #import_member_tvars tvars + #import_member_args args + #import_member_maybe? maybe? + #import_member_try? try? + #import_member_io? io?] + []]}) + )) + (<code>.form (do <>.monad + [kind (.is (Parser ImportMethodKind) + (<>.or (<code>.this (' "static")) + (in []))) + tvars (<>.else (list) ..vars^) + name <code>.local + ?alias import_member_alias^ + .let [total_vars (list#composite owner_vars tvars)] + ?prim_mode (<>.maybe primitive_mode^) + args (..import_member_args^ total_vars) + [io? try? maybe?] import_member_return_flags^ + return (..return^ total_vars)] + (in {#MethodDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_member_alias (maybe.else name ?alias) + #import_member_kind kind + #import_member_tvars tvars + #import_member_args args + #import_member_maybe? maybe? + #import_member_try? try? + #import_member_io? io?] + [#import_method_name name + #import_method_return return]]}))) + (<code>.form (do <>.monad + [static? (<>.parses? (<code>.this (' "static"))) + name <code>.local + ?prim_mode (<>.maybe primitive_mode^) + gtype (..type^ owner_vars) + maybe? (<>.parses? (<code>.this (' "?"))) + setter? (<>.parses? (<code>.this (' #!)))] + (in {#FieldAccessDecl [#import_field_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_field_name name + #import_field_static? static? + #import_field_maybe? maybe? + #import_field_setter? setter? + #import_field_type gtype]}))) + )) (def: (privacy_modifier$ pm) (-> Privacy Code) diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index 1888db385..fcd23b157 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -119,10 +119,10 @@ (template [<case> <name>] [(def: <case> (All (_ a) (-> (Parser a) (Parser (Named a)))) - (|>> ($_ <>.and - <name> - ..alias - )))] + (|>> (all <>.and + <name> + ..alias + )))] [named <code>.local] [anonymous (<>#in "")] @@ -160,11 +160,11 @@ (def: input (Parser Input) - ($_ <>.and - (<>#in (list)) - (<code>.tuple (<>.some ..optional)) - (<>.parses? (<code>.this_text "io")) - (<>.parses? (<code>.this_text "try")))) + (all <>.and + (<>#in (list)) + (<code>.tuple (<>.some ..optional)) + (<>.parses? (<code>.this_text "io")) + (<>.parses? (<code>.this_text "try")))) (type: Constructor (Named Input)) @@ -215,10 +215,10 @@ (Parser (Named Procedure)) (<| (..generalized (has [#anonymous #input #variables])) ..named - ($_ <>.and - ..input - ..optional - ))) + (all <>.and + ..input + ..optional + ))) (type: Method (Member (Named Procedure))) @@ -239,13 +239,13 @@ (`` (`` (def: sub (Parser Sub) - ($_ <>.or - (~~ (for @.lua (~~ (these)) - @.ruby (~~ (these)) - ..constructor)) - ..field - ..method - )))) + (all <>.or + (~~ (for @.lua (~~ (these)) + @.ruby (~~ (these)) + ..constructor)) + ..field + ..method + )))) (def: parameters (-> (List Optional) (List Optional)) @@ -319,14 +319,14 @@ (def: class (Parser Class) - ($_ <>.and - (<>.either (<>.and <code>.local - (<>#in (list))) - (<code>.form (<>.and <code>.local - (<>.some <code>.local)))) - ..alias - <code>.text - (<>.some ..sub))) + (all <>.and + (<>.either (<>.and <code>.local + (<>#in (list))) + (<code>.form (<>.and <code>.local + (<>.some <code>.local)))) + ..alias + <code>.text + (<>.some ..sub))) (type: Import (Variant @@ -336,10 +336,10 @@ (def: import (Parser Import) - ($_ <>.or - ..class - (<code>.form ..procedure) - (<code>.form (..named ..output)))) + (all <>.or + ..class + (<code>.form ..procedure) + (<code>.form (..named ..output)))) (def: (input_type input :it:) (-> Input Code Code) @@ -603,9 +603,9 @@ (for @.ruby (these) (syntax: .public (function [[self inputs] (<code>.form - ($_ <>.and - <code>.local - (<code>.tuple (<>.some (<>.and <code>.any <code>.any))))) + (all <>.and + <code>.local + (<code>.tuple (<>.some (<>.and <code>.any <code>.any))))) type <code>.any term <code>.any]) (in (list (` (.<| (.as ..Function) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 1758cb5bc..e79861b38 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -458,7 +458,7 @@ (do <>.monad [.let [dotted_name (format "::" field_name)] [_ _ value] (.is (Parser [Any Any Code]) - (<code>.form ($_ <>.and (<code>.this (' :=)) (<code>.this (code.symbol ["" dotted_name])) <code>.any)))] + (<code>.form (all <>.and (<code>.this (' :=)) (<code>.this (code.symbol ["" dotted_name])) <code>.any)))] (in (`' ((~ (code.text (format "jvm putfield" ":" class_name ":" field_name))) _jvm_this (~ value)))))) (def: (pre_walk_replace f input) @@ -554,19 +554,19 @@ (def: privacy_modifier^ (Parser Privacy) (let [(open "[0]") <>.monad] - ($_ <>.or - (<code>.this (' "public")) - (<code>.this (' "private")) - (<code>.this (' "protected")) - (in [])))) + (all <>.or + (<code>.this (' "public")) + (<code>.this (' "private")) + (<code>.this (' "protected")) + (in [])))) (def: inheritance_modifier^ (Parser Inheritance) (let [(open "[0]") <>.monad] - ($_ <>.or - (<code>.this (' "final")) - (<code>.this (' "abstract")) - (in [])))) + (all <>.or + (<code>.this (' "final")) + (<code>.this (' "abstract")) + (in [])))) (def: bound_kind^ (Parser BoundKind) @@ -582,46 +582,46 @@ (-> (List Type_Parameter) (Parser GenericType)) (<>.rec (function (_ again^) - ($_ <>.either - (do <>.monad - [_ (<code>.this (' ?))] - (in {#GenericWildcard {.#None}})) - (<code>.tuple (do <>.monad - [_ (<code>.this (' ?)) - bound_kind bound_kind^ - bound again^] - (in {#GenericWildcard {.#Some [bound_kind bound]}}))) - (do <>.monad - [name <code>.local - _ (no_periods_assertion name)] - (if (list.member? text.equivalence (list#each product.left type_vars) name) - (in {#GenericTypeVar name}) - (in {#GenericClass name (list)}))) - (<code>.tuple (do <>.monad - [component again^] - (case component - (^.template [<class> <name>] - [{#GenericClass <name> {.#End}} - (in {#GenericClass <class> (list)})]) - (["[Z" "boolean"] - ["[B" "byte"] - ["[S" "short"] - ["[I" "int"] - ["[J" "long"] - ["[F" "float"] - ["[D" "double"] - ["[C" "char"]) - - _ - (in {#GenericArray component})))) - (<code>.form (do <>.monad - [name <code>.local - _ (no_periods_assertion name) - params (<>.some again^) - _ (<>.assertion (format name " cannot be a type-parameter!") - (not (list.member? text.equivalence (list#each product.left type_vars) name)))] - (in {#GenericClass name params}))) - )))) + (all <>.either + (do <>.monad + [_ (<code>.this (' ?))] + (in {#GenericWildcard {.#None}})) + (<code>.tuple (do <>.monad + [_ (<code>.this (' ?)) + bound_kind bound_kind^ + bound again^] + (in {#GenericWildcard {.#Some [bound_kind bound]}}))) + (do <>.monad + [name <code>.local + _ (no_periods_assertion name)] + (if (list.member? text.equivalence (list#each product.left type_vars) name) + (in {#GenericTypeVar name}) + (in {#GenericClass name (list)}))) + (<code>.tuple (do <>.monad + [component again^] + (case component + (^.template [<class> <name>] + [{#GenericClass <name> {.#End}} + (in {#GenericClass <class> (list)})]) + (["[Z" "boolean"] + ["[B" "byte"] + ["[S" "short"] + ["[I" "int"] + ["[J" "long"] + ["[F" "float"] + ["[D" "double"] + ["[C" "char"]) + + _ + (in {#GenericArray component})))) + (<code>.form (do <>.monad + [name <code>.local + _ (no_periods_assertion name) + params (<>.some again^) + _ (<>.assertion (format name " cannot be a type-parameter!") + (not (list.member? text.equivalence (list#each product.left type_vars) name)))] + (in {#GenericClass name params}))) + )))) (def: type_param^ (Parser Type_Parameter) @@ -718,10 +718,10 @@ (def: state_modifier^ (Parser State) - ($_ <>.or - (<code>.this (' "volatile")) - (<code>.this (' "final")) - (# <>.monad in []))) + (all <>.or + (<code>.this (' "volatile")) + (<code>.this (' "final")) + (# <>.monad in []))) (def: (field_decl^ type_vars) (-> (List Type_Parameter) (Parser [Member_Declaration FieldDecl])) @@ -783,10 +783,10 @@ final? (<>.parses? (<code>.this (' "final"))) method_vars ..type_params^ .let [total_vars (list#composite class_vars method_vars)] - [name this_name arg_decls] (<code>.form ($_ <>.and - <code>.local - <code>.local - (..arg_decls^ total_vars))) + [name this_name arg_decls] (<code>.form (all <>.and + <code>.local + <code>.local + (..arg_decls^ total_vars))) return_type (..generic_type^ total_vars) exs (..throws_decl^ total_vars) annotations ..annotations^ @@ -806,10 +806,10 @@ owner_class ..class_decl^ method_vars ..type_params^ .let [total_vars (list#composite (product.right owner_class) method_vars)] - [name this_name arg_decls] (<code>.form ($_ <>.and - <code>.local - <code>.local - (..arg_decls^ total_vars))) + [name this_name arg_decls] (<code>.form (all <>.and + <code>.local + <code>.local + (..arg_decls^ total_vars))) return_type (..generic_type^ total_vars) exs (..throws_decl^ total_vars) annotations ..annotations^ @@ -877,13 +877,13 @@ (def: (method_def^ class_vars) (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition])) - ($_ <>.either - (..constructor_method^ class_vars) - (..virtual_method_def^ class_vars) - ..overriden_method_def^ - ..static_method_def^ - ..abstract_method_def^ - ..native_method_def^)) + (all <>.either + (..constructor_method^ class_vars) + (..virtual_method_def^ class_vars) + ..overriden_method_def^ + ..static_method_def^ + ..abstract_method_def^ + ..native_method_def^)) (def: partial_call^ (Parser Partial_Call) @@ -901,7 +901,7 @@ (def: import_member_return_flags^ (Parser [Bit Bit Bit]) - ($_ <>.and (<>.parses? (<code>.this (' "io"))) (<>.parses? (<code>.this (' "try"))) (<>.parses? (<code>.this (' "?"))))) + (all <>.and (<>.parses? (<code>.this (' "io"))) (<>.parses? (<code>.this (' "try"))) (<>.parses? (<code>.this (' "?"))))) (def: primitive_mode^ (Parser Primitive_Mode) @@ -910,64 +910,64 @@ (def: (import_member_decl^ owner_vars) (-> (List Type_Parameter) (Parser Import_Member_Declaration)) - ($_ <>.either - (<code>.form (do <>.monad - [_ (<code>.this (' "enum")) - enum_members (<>.some <code>.local)] - (in {#EnumDecl enum_members}))) - (<code>.form (do <>.monad - [tvars ..type_params^ - _ (<code>.this (' new)) - ?alias import_member_alias^ - .let [total_vars (list#composite owner_vars tvars)] - ?prim_mode (<>.maybe primitive_mode^) - args (..import_member_args^ total_vars) - [io? try? maybe?] import_member_return_flags^] - (in {#ConstructorDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_member_alias (maybe.else "new" ?alias) - #import_member_kind {#VirtualIMK} - #import_member_tvars tvars - #import_member_args args - #import_member_maybe? maybe? - #import_member_try? try? - #import_member_io? io?] - []]}))) - (<code>.form (do <>.monad - [kind (.is (Parser ImportMethodKind) - (<>.or (<code>.this (' "static")) - (in []))) - tvars ..type_params^ - name <code>.local - ?alias import_member_alias^ - .let [total_vars (list#composite owner_vars tvars)] - ?prim_mode (<>.maybe primitive_mode^) - args (..import_member_args^ total_vars) - [io? try? maybe?] import_member_return_flags^ - return (..generic_type^ total_vars)] - (in {#MethodDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_member_alias (maybe.else name ?alias) - #import_member_kind kind - #import_member_tvars tvars - #import_member_args args - #import_member_maybe? maybe? - #import_member_try? try? - #import_member_io? io?] - [#import_method_name name - #import_method_return return]]}))) - (<code>.form (do <>.monad - [static? (<>.parses? (<code>.this (' "static"))) - name <code>.local - ?prim_mode (<>.maybe primitive_mode^) - gtype (..generic_type^ owner_vars) - maybe? (<>.parses? (<code>.this (' "?"))) - setter? (<>.parses? (<code>.this (' "!")))] - (in {#FieldAccessDecl [#import_field_mode (maybe.else {#AutoPrM} ?prim_mode) - #import_field_name name - #import_field_static? static? - #import_field_maybe? maybe? - #import_field_setter? setter? - #import_field_type gtype]}))) - )) + (all <>.either + (<code>.form (do <>.monad + [_ (<code>.this (' "enum")) + enum_members (<>.some <code>.local)] + (in {#EnumDecl enum_members}))) + (<code>.form (do <>.monad + [tvars ..type_params^ + _ (<code>.this (' new)) + ?alias import_member_alias^ + .let [total_vars (list#composite owner_vars tvars)] + ?prim_mode (<>.maybe primitive_mode^) + args (..import_member_args^ total_vars) + [io? try? maybe?] import_member_return_flags^] + (in {#ConstructorDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_member_alias (maybe.else "new" ?alias) + #import_member_kind {#VirtualIMK} + #import_member_tvars tvars + #import_member_args args + #import_member_maybe? maybe? + #import_member_try? try? + #import_member_io? io?] + []]}))) + (<code>.form (do <>.monad + [kind (.is (Parser ImportMethodKind) + (<>.or (<code>.this (' "static")) + (in []))) + tvars ..type_params^ + name <code>.local + ?alias import_member_alias^ + .let [total_vars (list#composite owner_vars tvars)] + ?prim_mode (<>.maybe primitive_mode^) + args (..import_member_args^ total_vars) + [io? try? maybe?] import_member_return_flags^ + return (..generic_type^ total_vars)] + (in {#MethodDecl [[#import_member_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_member_alias (maybe.else name ?alias) + #import_member_kind kind + #import_member_tvars tvars + #import_member_args args + #import_member_maybe? maybe? + #import_member_try? try? + #import_member_io? io?] + [#import_method_name name + #import_method_return return]]}))) + (<code>.form (do <>.monad + [static? (<>.parses? (<code>.this (' "static"))) + name <code>.local + ?prim_mode (<>.maybe primitive_mode^) + gtype (..generic_type^ owner_vars) + maybe? (<>.parses? (<code>.this (' "?"))) + setter? (<>.parses? (<code>.this (' "!")))] + (in {#FieldAccessDecl [#import_field_mode (maybe.else {#AutoPrM} ?prim_mode) + #import_field_name name + #import_field_static? static? + #import_field_maybe? maybe? + #import_field_setter? setter? + #import_field_type gtype]}))) + )) ... Generators (def: with_parens diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index 840fb30de..bd2176adb 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -71,19 +71,19 @@ (def: field (Parser Field) - (<code>.form ($_ <>.and - (<>.parses? ..static!) - <code>.local - (<>.maybe ..alias) - ..nullable))) + (<code>.form (all <>.and + (<>.parses? ..static!) + <code>.local + (<>.maybe ..alias) + ..nullable))) (def: constant (Parser Field) - (<code>.form ($_ <>.and - (<>#in true) - <code>.local - (<>.maybe ..alias) - ..nullable))) + (<code>.form (all <>.and + (<>#in true) + <code>.local + (<>.maybe ..alias) + ..nullable))) (type: Common_Method (Record @@ -104,13 +104,13 @@ (def: common_method (Parser Common_Method) - ($_ <>.and - <code>.local - (<>.maybe ..alias) - (<code>.tuple (<>.some ..nullable)) - (<>.parses? (<code>.this (' "io"))) - (<>.parses? (<code>.this (' "try"))) - ..nullable)) + (all <>.and + <code>.local + (<>.maybe ..alias) + (<code>.tuple (<>.some ..nullable)) + (<>.parses? (<code>.this (' "io"))) + (<>.parses? (<code>.this (' "try"))) + ..nullable)) (def: static_method (<>.after ..static! ..common_method)) @@ -127,10 +127,10 @@ (def: member (Parser Member) - ($_ <>.or - ..field - ..method - )) + (all <>.or + ..field + ..method + )) (def: input_variables (-> (List Nullable) (List [Bit Code])) @@ -175,16 +175,16 @@ (def: import (Parser Import) - ($_ <>.or - ($_ <>.and - <code>.local - (<>.maybe ..alias) - (<>.else ["" (list)] - (<code>.tuple (<>.and <code>.text - (<>.some member))))) - (<code>.form ..common_method) - ..constant - )) + (all <>.or + (all <>.and + <code>.local + (<>.maybe ..alias) + (<>.else ["" (list)] + (<code>.tuple (<>.and <code>.text + (<>.some member))))) + (<code>.form ..common_method) + ..constant + )) (syntax: .public (try [expression <code>.any]) ... {.#doc (example (case (try (risky_computation input)) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 7b338dfd4..79b042679 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -71,19 +71,19 @@ (def: field (Parser Field) - (<code>.form ($_ <>.and - (<>.parses? ..static!) - <code>.local - (<>.maybe ..alias) - ..nilable))) + (<code>.form (all <>.and + (<>.parses? ..static!) + <code>.local + (<>.maybe ..alias) + ..nilable))) (def: constant (Parser Field) - (<code>.form ($_ <>.and - (<>#in true) - <code>.local - (<>.maybe ..alias) - ..nilable))) + (<code>.form (all <>.and + (<>#in true) + <code>.local + (<>.maybe ..alias) + ..nilable))) (type: Common_Method (Record @@ -96,13 +96,13 @@ (def: common_method (Parser Common_Method) - ($_ <>.and - <code>.local - (<>.maybe ..alias) - (<code>.tuple (<>.some ..nilable)) - (<>.parses? (<code>.this (' "io"))) - (<>.parses? (<code>.this (' "try"))) - ..nilable)) + (all <>.and + <code>.local + (<>.maybe ..alias) + (<code>.tuple (<>.some ..nilable)) + (<>.parses? (<code>.this (' "io"))) + (<>.parses? (<code>.this (' "try"))) + ..nilable)) (def: input_variables (-> (List Nilable) (List [Bit Code])) @@ -146,10 +146,10 @@ (def: import (Parser Import) - ($_ <>.or - (<code>.form ..common_method) - ..constant - )) + (all <>.or + (<code>.form ..common_method) + ..constant + )) (syntax: .public (try [expression <code>.any]) ... {.#doc (example (case (try (risky_computation input)) diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index ffe1daa6a..e889ad68f 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -42,9 +42,9 @@ (<code>.result (<| <code>.form (<>.after (<code>.this_text "lux def")) (<>.before <code>.any) - ($_ <>.and - <code>.local - <code>.any))) + (all <>.and + <code>.local + <code>.any))) meta.lifted)) (with_expansions [<extension> (static.random (|>> %.nat (%.format "lua export ") code.text) @@ -77,9 +77,9 @@ definition (/.define (/.var name) term) export (/.when (/.not (/.= (/.string "undefined") (/.type_of $module))) (/.set (/.the name $exports) (/.var name))) - code ($_ /.then - definition - export)] + code (all /.then + definition + export)] _ (generation.execute! definition) _ (generation.save! @self {.#None} code)] (generation.log! (%.format "Export " (%.text name)))))] diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux index fa1631922..ec79f469f 100644 --- a/stdlib/source/library/lux/ffi/export.jvm.lux +++ b/stdlib/source/library/lux/ffi/export.jvm.lux @@ -21,11 +21,11 @@ (def: (api of) (All (_ of) (-> (Parser of) (Parser (API of)))) (<code>.form - ($_ <>.and - of - <code>.any - <code>.any - ))) + (all <>.and + of + <code>.any + <code>.any + ))) (type: Constant Text) @@ -43,14 +43,14 @@ (def: function (Parser Function) (<code>.form - ($_ <>.and - (<>.else (list) (<code>.tuple (<>.some <code>.local))) - <code>.local - (<code>.tuple (<>.some ($_ <>.and - <code>.local - <code>.any - ))) - ))) + (all <>.and + (<>.else (list) (<code>.tuple (<>.some <code>.local))) + <code>.local + (<code>.tuple (<>.some (all <>.and + <code>.local + <code>.any + ))) + ))) (type: Export (Variant @@ -59,10 +59,10 @@ (def: export (Parser Export) - ($_ <>.or - (..api ..constant) - (..api ..function) - )) + (all <>.or + (..api ..constant) + (..api ..function) + )) (syntax: .public (export: [api <code>.local exports (<>.many ..export)]) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index 33601347b..86365d524 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -42,9 +42,9 @@ (<code>.result (<| <code>.form (<>.after (<code>.this_text "lux def")) (<>.before <code>.any) - ($_ <>.and - <code>.local - <code>.any))) + (all <>.and + <code>.local + <code>.any))) meta.lifted)) ... [15.2 – Privacy](https://www.lua.org/pil/15.2.html) @@ -87,17 +87,17 @@ (list)) (/.var name)) export! (/.when exporting? - ($_ /.then - (/.when no_exports? - initialize_exports!) - export_definition! - ))] - _ (generation.execute! ($_ /.then - (/.set (list (/.var name)) term) - export!)) - _ (generation.save! @self {.#None} ($_ /.then - (/.local/1 (/.var name) term) - export!))] + (all /.then + (/.when no_exports? + initialize_exports!) + export_definition! + ))] + _ (generation.execute! (all /.then + (/.set (list (/.var name)) term) + export!)) + _ (generation.save! @self {.#None} (all /.then + (/.local/1 (/.var name) term) + export!))] (generation.log! (%.format "Export " (%.text name)))))] (in directive.no_requirements))) diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index febcdaf89..08ef62188 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -42,9 +42,9 @@ (<code>.result (<| <code>.form (<>.after (<code>.this_text "lux def")) (<>.before <code>.any) - ($_ <>.and - <code>.local - <code>.any))) + (all <>.and + <code>.local + <code>.any))) meta.lifted)) (with_expansions [<extension> (static.random (|>> %.nat (%.format "python export ") code.text) diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index 59fba650f..017f40093 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -44,12 +44,12 @@ (def: sigil! (<text>.one_of! "_")) (def: tail! - ($_ <>.either - ..upper! - ..lower! - ..decimal! - ..sigil! - )) + (all <>.either + ..upper! + ..lower! + ..decimal! + ..sigil! + )) (template [<name> <head>] [(def: <name> @@ -80,9 +80,9 @@ (<code>.result (<| <code>.form (<>.after (<code>.this_text "lux def")) (<>.before <code>.any) - ($_ <>.and - (<text>.then ..name <code>.local) - <code>.any))) + (all <>.and + (<text>.then ..name <code>.local) + <code>.any))) meta.lifted)) (with_expansions [<extension> (static.random (|>> %.nat (%.format "ruby export ") code.text) diff --git a/stdlib/source/library/lux/ffi/node_js.js.lux b/stdlib/source/library/lux/ffi/node_js.js.lux index 08e649fa9..dd83109f1 100644 --- a/stdlib/source/library/lux/ffi/node_js.js.lux +++ b/stdlib/source/library/lux/ffi/node_js.js.lux @@ -19,7 +19,7 @@ (def: .public (require module) (-> Text (Maybe Any)) (maybe#each (function.on module) - ($_ maybe#composite - ..normal_require - ..global_require - ..process_load))) + (all maybe#composite + ..normal_require + ..global_require + ..process_load))) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index d8e677ba6..f4b582ef6 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -97,7 +97,7 @@ [id //.seed] (in (|> id (# nat.decimal encoded) - ($_ text#composite "__gensym__" prefix) + (all text#composite "__gensym__" prefix) [""] code.symbol)))) (def: (local ast) @@ -161,7 +161,7 @@ (do //.monad [location //.location output (<func> token) - .let [_ ("lux io log" ($_ text#composite (symbol#encoded macro_name) " " (location.format location))) + .let [_ ("lux io log" (all text#composite (symbol#encoded macro_name) " " (location.format location))) _ (list#each (|>> code.format "lux io log") output) _ ("lux io log" "")]] diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index 4df6d86e0..e86024d13 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -104,16 +104,16 @@ (^.template [<tag> <open> <close>] [[_ {<tag> members}] - ($_ text#composite - <open> - (list#mix (function (_ next prev) - (let [next (format next)] - (if (text#= "" prev) - next - ($_ text#composite prev " " next)))) - "" - members) - <close>)]) + (all text#composite + <open> + (list#mix (function (_ next prev) + (let [next (format next)] + (if (text#= "" prev) + next + (all text#composite prev " " next)))) + "" + members) + <close>)]) ([.#Form "(" ")"] [.#Variant "{" "}"] [.#Tuple "[" "]"]) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 8a3783149..9a2e566f0 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -33,9 +33,9 @@ {try.#Success [tokens output]} {try.#Failure error} - {try.#Failure ($_ text#composite - "Failed to parse: " (code.format binding) text.new_line - error)}))) + {try.#Failure (all text#composite + "Failed to parse: " (code.format binding) text.new_line + error)}))) (def: (un_paired pairs) (All (_ a) (-> (List [a a]) (List a))) @@ -46,11 +46,11 @@ (def: syntax (Parser [Code [Text (List Code)] Code]) (/export.parser - ($_ <>.and - (</>.form ($_ <>.and - </>.local - (</>.tuple (<>.some </>.any)))) - </>.any))) + (all <>.and + (</>.form (all <>.and + </>.local + (</>.tuple (<>.some </>.any)))) + </>.any))) (macro: .public (syntax: tokens) (case (</>.result ..syntax tokens) diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index da0ad9ca1..da68a8f25 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -24,10 +24,10 @@ (def: .public equivalence (Equivalence Check) - ($_ product.equivalence - code.equivalence - code.equivalence - )) + (all product.equivalence + code.equivalence + code.equivalence + )) (def: .public (format (open "_[0]")) (-> Check Code) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index f6c92855e..be174fdd5 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -21,10 +21,10 @@ (def: .public equivalence (Equivalence Declaration) - ($_ product.equivalence - text.equivalence - (list.equivalence text.equivalence) - )) + (all product.equivalence + text.equivalence + (list.equivalence text.equivalence) + )) (def: .public parser (Parser Declaration) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index af8e3baf0..47b419339 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -32,14 +32,14 @@ (def: .public equivalence (Equivalence Definition) - ($_ product.equivalence - text.equivalence - ($_ sum.equivalence - //check.equivalence - code.equivalence - ) - bit.equivalence - )) + (all product.equivalence + text.equivalence + (all sum.equivalence + //check.equivalence + code.equivalence + ) + bit.equivalence + )) (def: extension "lux def") @@ -73,12 +73,12 @@ (<| (<code>.locally me_raw) <code>.form (<>.after (<code>.this_text ..extension)) - ($_ <>.and - <code>.local - (<>.or //check.parser - <code>.any) - <code>.bit - )))) + (all <>.and + <code>.local + (<>.or //check.parser + <code>.any) + <code>.bit + )))) (exception: .public (lacks_type [definition Definition]) (exception.report diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux index 6d7d8c357..9e66ad43e 100644 --- a/stdlib/source/library/lux/macro/syntax/input.lux +++ b/stdlib/source/library/lux/macro/syntax/input.lux @@ -20,10 +20,10 @@ (def: .public equivalence (Equivalence Input) - ($_ product.equivalence - code.equivalence - code.equivalence - )) + (all product.equivalence + code.equivalence + code.equivalence + )) (def: .public format (-> (List Input) Code) @@ -37,7 +37,7 @@ (Parser (List Input)) (<| <code>.tuple <>.some - ($_ <>.and - <code>.any - <code>.any - ))) + (all <>.and + <code>.any + <code>.any + ))) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 090a25ac4..e866798bb 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -59,18 +59,18 @@ (def: (snippet module_side?) (-> Bit (Parser Text)) (.let [full_symbol (..symbol_side module_side? <code>.symbol)] - ($_ <>.either - <code>.text - (if module_side? - full_symbol - (<>.either <code>.local - full_symbol)) - (<>#each bit#encoded <code>.bit) - (<>#each nat#encoded <code>.nat) - (<>#each int#encoded <code>.int) - (<>#each rev#encoded <code>.rev) - (<>#each frac#encoded <code>.frac) - ))) + (all <>.either + <code>.text + (if module_side? + full_symbol + (<>.either <code>.local + full_symbol)) + (<>#each bit#encoded <code>.bit) + (<>#each nat#encoded <code>.nat) + (<>#each int#encoded <code>.int) + (<>#each rev#encoded <code>.rev) + (<>#each frac#encoded <code>.frac) + ))) (def: (part module_side?) (-> Bit (Parser (List Text))) diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index b5b44fc24..c7dd7efa5 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["<>" parser ("[1]#[0]" functor) - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]#[0]" mix)]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["n" nat] - ["i" int]]]]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["<>" parser ("[1]#[0]" functor) + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]#[0]" mix)]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["n" nat] + ["i" int]]]]]) (type: Infix (Rec Infix @@ -28,32 +28,32 @@ (def: literal (Parser Code) - ($_ <>.either - (<>#each code.bit <code>.bit) - (<>#each code.nat <code>.nat) - (<>#each code.int <code>.int) - (<>#each code.rev <code>.rev) - (<>#each code.frac <code>.frac) - (<>#each code.text <code>.text) - (<>#each code.symbol <code>.symbol))) + (all <>.either + (<>#each code.bit <code>.bit) + (<>#each code.nat <code>.nat) + (<>#each code.int <code>.int) + (<>#each code.rev <code>.rev) + (<>#each code.frac <code>.frac) + (<>#each code.text <code>.text) + (<>#each code.symbol <code>.symbol))) (def: expression (Parser Infix) (<| <>.rec (function (_ expression)) - ($_ <>.or - ..literal - (<code>.form (<>.many <code>.any)) - (<code>.tuple (<>.and <code>.any expression)) - (<code>.tuple (do <>.monad - [init_subject expression - init_op <code>.any - init_param expression - steps (<>.some (<>.and <code>.any expression))] - (in (list#mix (function (_ [op param] [_subject _op _param]) - [{#Binary _subject _op _param} op param]) - [init_subject init_op init_param] - steps)))) - ))) + (all <>.or + ..literal + (<code>.form (<>.many <code>.any)) + (<code>.tuple (<>.and <code>.any expression)) + (<code>.tuple (do <>.monad + [init_subject expression + init_op <code>.any + init_param expression + steps (<>.some (<>.and <code>.any expression))] + (in (list#mix (function (_ [op param] [_subject _op _param]) + [{#Binary _subject _op _param} op param]) + [init_subject init_op init_param] + steps)))) + ))) (def: (prefix infix) (-> Infix Code) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index f23071295..6c4263f23 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -65,15 +65,15 @@ (def: (encoded modular) (let [[_ value] (representation modular)] - ($_ text#composite - (i#encoded value) - ..separator - (i#encoded (//.divisor expected))))) + (all text#composite + (i#encoded value) + ..separator + (i#encoded (//.divisor expected))))) (def: decoded (<text>.result (do <>.monad - [[value _ actual] ($_ <>.and intL (<text>.this ..separator) intL) + [[value _ actual] (all <>.and intL (<text>.this ..separator) intL) _ (<>.assertion (exception.error ..incorrect_modulus [expected actual]) (i.= (//.divisor expected) actual))] (in (..modular expected value)))))) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index 0169ec4f5..14f6c9746 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -694,10 +694,10 @@ (//int.+ (.int ..double_bias)) (//i64.and ..exponent_mask)) mantissa_bits (..int mantissa)] - ($_ //i64.or - (//i64.left_shifted ..sign_offset sign_bit) - (//i64.left_shifted ..exponent_offset exponent_bits) - (//i64.zero ..mantissa_size mantissa_bits))) + (all //i64.or + (//i64.left_shifted ..sign_offset sign_bit) + (//i64.left_shifted ..exponent_offset exponent_bits) + (//i64.zero ..mantissa_size mantissa_bits))) ))) (template [<getter> <size> <offset>] @@ -783,14 +783,14 @@ mantissa (..mantissa bits) exponent (//int.- (.int ..double_bias) (..exponent bits)) sign (..sign bits)] - ($_ "lux text concat" - (case (.nat sign) - 1 "-" - 0 "+" - _ (undefined)) - (# <nat> encoded (.nat mantissa)) - ".0E" - (# <int> encoded exponent)))) + (all "lux text concat" + (case (.nat sign) + 1 "-" + 0 "+" + _ (undefined)) + (# <nat> encoded (.nat mantissa)) + ".0E" + (# <int> encoded exponent)))) (def: (decoded representation) (let [negative? (text.starts_with? "-" representation) @@ -817,10 +817,10 @@ _ ("lux text concat" whole (# <nat> encoded decimal)))) .let [sign (if negative? 1 0)]] (in (..of_bits - ($_ //i64.or - (//i64.left_shifted ..sign_offset (.i64 sign)) - (//i64.left_shifted ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent))) - (//i64.zero ..mantissa_size (.i64 mantissa)))))) + (all //i64.or + (//i64.left_shifted ..sign_offset (.i64 sign)) + (//i64.left_shifted ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent))) + (//i64.zero ..mantissa_size (.i64 mantissa)))))) {try.#Failure ("lux text concat" <error> representation)}))))] [binary //nat.binary //int.binary "Invalid binary syntax: "] diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 883e63dae..5af8853ad 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -132,9 +132,9 @@ (Codec Text Ratio) (def: (encoded (open "_[0]")) - ($_ text#composite - (n#encoded _#numerator) - ..separator (n#encoded _#denominator))) + (all text#composite + (n#encoded _#numerator) + ..separator (n#encoded _#denominator))) (def: (decoded input) (case (text.split_by ..separator input) diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index c6cdd0995..e6154d42f 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -343,10 +343,10 @@ output (..digits [])]) (if (//int.< +0 (.int idx)) output - (let [raw ($_ //nat.+ - carry - (..digit idx param) - (..digit idx subject))] + (let [raw (all //nat.+ + carry + (..digit idx param) + (..digit idx subject))] (again (-- idx) (//nat./ 10 raw) (digits#put! idx (//nat.% 10 raw) output)))))) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index f1337c481..3f6c82f27 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -123,7 +123,7 @@ {try.#Success [lux module]} _ - {try.#Failure ($_ text#composite "Unknown module: " name)}))) + {try.#Failure (all text#composite "Unknown module: " name)}))) (def: .public current_module_name (Meta Text) @@ -275,7 +275,7 @@ ((clean_type var_type) lux) {.#None} - {try.#Failure ($_ text#composite "Unknown variable: " name)})))) + {try.#Failure (all text#composite "Unknown variable: " name)})))) (def: without_lux_runtime (-> (List Text) (List Text)) @@ -285,7 +285,7 @@ (def: listing_separator Text - ($_ text#composite text.new_line " ")) + (all text#composite text.new_line " ")) (def: module_listing (-> (List Text) Text) @@ -314,52 +314,52 @@ (the .#modules) (list#each product.left) ..module_listing)] - {try.#Failure ($_ text#composite - "Unknown definition: " (symbol#encoded name) text.new_line - " Current module: " current_module text.new_line - (case (plist.value current_module (the .#modules lux)) - {.#Some this_module} - (let [candidates (|> lux - (the .#modules) - (list#each (function (_ [module_name module]) - (|> module - (the .#definitions) - (list.all (function (_ [def_name global]) - (case global - (^.or {.#Definition [exported? _]} - {.#Type [exported? _]}) - (if (and exported? - (text#= normal_short def_name)) - {.#Some (symbol#encoded [module_name def_name])} - {.#None}) - - {.#Alias _} - {.#None} - - {.#Tag _} - {.#None} - - {.#Slot _} - {.#None})))))) - list.together - (list.sorted text#<) - (text.interposed ..listing_separator)) - imports (|> this_module - (the .#imports) - ..module_listing) - aliases (|> this_module - (the .#module_aliases) - (list#each (function (_ [alias real]) ($_ text#composite alias " => " real))) - (list.sorted text#<) - (text.interposed ..listing_separator))] - ($_ text#composite - " Candidates: " candidates text.new_line - " Imports: " imports text.new_line - " Aliases: " aliases text.new_line)) - - _ - "") - " All known modules: " all_known_modules text.new_line)}))))) + {try.#Failure (all text#composite + "Unknown definition: " (symbol#encoded name) text.new_line + " Current module: " current_module text.new_line + (case (plist.value current_module (the .#modules lux)) + {.#Some this_module} + (let [candidates (|> lux + (the .#modules) + (list#each (function (_ [module_name module]) + (|> module + (the .#definitions) + (list.all (function (_ [def_name global]) + (case global + (^.or {.#Definition [exported? _]} + {.#Type [exported? _]}) + (if (and exported? + (text#= normal_short def_name)) + {.#Some (symbol#encoded [module_name def_name])} + {.#None}) + + {.#Alias _} + {.#None} + + {.#Tag _} + {.#None} + + {.#Slot _} + {.#None})))))) + list.together + (list.sorted text#<) + (text.interposed ..listing_separator)) + imports (|> this_module + (the .#imports) + ..module_listing) + aliases (|> this_module + (the .#module_aliases) + (list#each (function (_ [alias real]) (all text#composite alias " => " real))) + (list.sorted text#<) + (text.interposed ..listing_separator))] + (all text#composite + " Candidates: " candidates text.new_line + " Imports: " imports text.new_line + " Aliases: " aliases text.new_line)) + + _ + "") + " All known modules: " all_known_modules text.new_line)}))))) (def: .public (export name) (-> Symbol (Meta Definition)) @@ -370,27 +370,27 @@ (let [[exported? def_type def_value] definition] (if exported? (in definition) - (failure ($_ text#composite "Definition is not an export: " (symbol#encoded name))))) + (failure (all text#composite "Definition is not an export: " (symbol#encoded name))))) {.#Type [exported? type labels]} (if exported? (in [exported? .Type type]) - (failure ($_ text#composite "Type is not an export: " (symbol#encoded name)))) + (failure (all text#composite "Type is not an export: " (symbol#encoded name)))) {.#Alias de_aliased} - (failure ($_ text#composite - "Aliases are not considered exports: " - (symbol#encoded name))) + (failure (all text#composite + "Aliases are not considered exports: " + (symbol#encoded name))) {.#Tag _} - (failure ($_ text#composite - "Tags are not considered exports: " - (symbol#encoded name))) + (failure (all text#composite + "Tags are not considered exports: " + (symbol#encoded name))) {.#Slot _} - (failure ($_ text#composite - "Slots are not considered exports: " - (symbol#encoded name)))))) + (failure (all text#composite + "Slots are not considered exports: " + (symbol#encoded name)))))) (def: .public (definition_type name) (-> Symbol (Meta Type)) @@ -407,14 +407,14 @@ (in .Type) {.#Tag _} - (failure ($_ text#composite - "Tags have no type: " - (symbol#encoded name))) + (failure (all text#composite + "Tags have no type: " + (symbol#encoded name))) {.#Slot _} - (failure ($_ text#composite - "Slots have no type: " - (symbol#encoded name)))))) + (failure (all text#composite + "Slots have no type: " + (symbol#encoded name)))))) (def: .public (type name) (-> Symbol (Meta Type)) @@ -441,23 +441,23 @@ (type_code .Type) (type_code def_type))) (in (as Type def_value)) - (..failure ($_ text#composite "Definition is not a type: " (symbol#encoded name))))) + (..failure (all text#composite "Definition is not a type: " (symbol#encoded name))))) {.#Type [exported? type labels]} (in type) {.#Tag _} - (..failure ($_ text#composite "Tag is not a type: " (symbol#encoded name))) + (..failure (all text#composite "Tag is not a type: " (symbol#encoded name))) {.#Slot _} - (..failure ($_ text#composite "Slot is not a type: " (symbol#encoded name)))))) + (..failure (all text#composite "Slot is not a type: " (symbol#encoded name)))))) (def: .public (globals module) (-> Text (Meta (List [Text Global]))) (function (_ lux) (case (plist.value module (the .#modules lux)) {.#None} - {try.#Failure ($_ text#composite "Unknown module: " module)} + {try.#Failure (all text#composite "Unknown module: " module)} {.#Some module} {try.#Success [lux (the .#definitions module)]}))) @@ -562,11 +562,11 @@ (if (or (text#= this_module_name module) exported?) (in [idx (list#each (|>> [module]) group) type]) - (..failure ($_ text#composite "Cannot access " <description> ": " (symbol#encoded label_name) " from module " this_module_name))) + (..failure (all text#composite "Cannot access " <description> ": " (symbol#encoded label_name) " from module " this_module_name))) _ - (..failure ($_ text#composite - "Unknown " <description> ": " (symbol#encoded label_name))))))] + (..failure (all text#composite + "Unknown " <description> ": " (symbol#encoded label_name))))))] [tag .#Tag "tag"] [slot .#Slot "slot"] diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index b1448bf9e..13bb059d3 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -35,16 +35,16 @@ (-> Location Text) (let [separator "," [file line column] it] - ($_ "lux text concat" - "@" - (`` (("lux in-module" (~~ (static .prelude_module)) .text#encoded) file)) separator - (`` (("lux in-module" (~~ (static .prelude_module)) .nat#encoded) line)) separator - (`` (("lux in-module" (~~ (static .prelude_module)) .nat#encoded) column))))) + (all "lux text concat" + "@" + (`` (("lux in-module" (~~ (static .prelude_module)) .text#encoded) file)) separator + (`` (("lux in-module" (~~ (static .prelude_module)) .nat#encoded) line)) separator + (`` (("lux in-module" (~~ (static .prelude_module)) .nat#encoded) column))))) (def: \n ("lux i64 char" +10)) (def: .public (with location error) (-> Location Text Text) - ($_ "lux text concat" (..format location) \n - error)) + (all "lux text concat" (..format location) \n + error)) diff --git a/stdlib/source/library/lux/meta/symbol.lux b/stdlib/source/library/lux/meta/symbol.lux index e745413af..15e96c352 100644 --- a/stdlib/source/library/lux/meta/symbol.lux +++ b/stdlib/source/library/lux/meta/symbol.lux @@ -48,7 +48,7 @@ (def: (encoded [module short]) (case module "" short - _ ($_ text#composite module ..separator short))) + _ (all text#composite module ..separator short))) (def: (decoded input) (case (text.all_split_by ..separator input) diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 6fd6eba84..c59e77236 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -39,10 +39,10 @@ (All (_ about) (-> (Equivalence about) (Equivalence (Info about)))) - ($_ product.equivalence - //index.equivalence - //unsigned.equivalence - Equivalence<about>)) + (all product.equivalence + //index.equivalence + //unsigned.equivalence + Equivalence<about>)) (def: (info_writer writer) (All (_ about) @@ -52,7 +52,7 @@ (let [[nameS nameT] (//index.writer name) [lengthS lengthT] (//unsigned.writer/4 length) [infoS infoT] (writer info)] - [($_ n.+ nameS lengthS infoS) + [(all n.+ nameS lengthS infoS) (|>> nameT lengthT infoT)]))) (with_expansions [<Code> (these (/code.Code Attribute))] @@ -71,19 +71,19 @@ (Equivalence Attribute) (equivalence.rec (function (_ equivalence) - ($_ sum.equivalence - (info_equivalence /constant.equivalence) - (info_equivalence (/code.equivalence equivalence)) - (info_equivalence //index.equivalence) - )))) + (all sum.equivalence + (info_equivalence /constant.equivalence) + (info_equivalence (/code.equivalence equivalence)) + (info_equivalence //index.equivalence) + )))) (def: common_attribute_length - ($_ n.+ - ... u2 attribute_name_index; - //unsigned.bytes/2 - ... u4 attribute_length; - //unsigned.bytes/4 - )) + (all n.+ + ... u2 attribute_name_index; + //unsigned.bytes/2 + ... u4 attribute_length; + //unsigned.bytes/4 + )) (def: (length attribute) (-> Attribute Nat) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index 9916f97b0..5d2ed4879 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -31,53 +31,53 @@ (def: .public (length length code) (All (_ Attribute) (-> (-> Attribute Nat) (Code Attribute) Nat)) - ($_ n.+ - ... u2 max_stack; - ... u2 max_locals; - ///limit.length - ... u4 code_length; - ///unsigned.bytes/4 - ... u1 code[code_length]; - (binary.size (the #code code)) - ... u2 exception_table_length; - ///unsigned.bytes/2 - ... exception_table[exception_table_length]; - (|> code - (the #exception_table) - sequence.size - (n.* /exception.length)) - ... u2 attributes_count; - ///unsigned.bytes/2 - ... attribute_info attributes[attributes_count]; - (|> code - (the #attributes) - (sequence#each length) - (sequence#mix n.+ 0)))) + (all n.+ + ... u2 max_stack; + ... u2 max_locals; + ///limit.length + ... u4 code_length; + ///unsigned.bytes/4 + ... u1 code[code_length]; + (binary.size (the #code code)) + ... u2 exception_table_length; + ///unsigned.bytes/2 + ... exception_table[exception_table_length]; + (|> code + (the #exception_table) + sequence.size + (n.* /exception.length)) + ... u2 attributes_count; + ///unsigned.bytes/2 + ... attribute_info attributes[attributes_count]; + (|> code + (the #attributes) + (sequence#each length) + (sequence#mix n.+ 0)))) (def: .public (equivalence attribute_equivalence) (All (_ attribute) (-> (Equivalence attribute) (Equivalence (Code attribute)))) - ($_ product.equivalence - ///limit.equivalence - binary.equivalence - (sequence.equivalence /exception.equivalence) - (sequence.equivalence attribute_equivalence) - )) + (all product.equivalence + ///limit.equivalence + binary.equivalence + (sequence.equivalence /exception.equivalence) + (sequence.equivalence attribute_equivalence) + )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 (def: .public (writer writer code) (All (_ Attribute) (-> (Writer Attribute) (Writer (Code Attribute)))) - ($_ binaryF#composite - ... u2 max_stack; - ... u2 max_locals; - (///limit.writer (the #limit code)) - ... u4 code_length; - ... u1 code[code_length]; - (binaryF.binary_32 (the #code code)) - ... u2 exception_table_length; - ... exception_table[exception_table_length]; - ((binaryF.sequence_16 /exception.writer) (the #exception_table code)) - ... u2 attributes_count; - ... attribute_info attributes[attributes_count]; - ((binaryF.sequence_16 writer) (the #attributes code)) - )) + (all binaryF#composite + ... u2 max_stack; + ... u2 max_locals; + (///limit.writer (the #limit code)) + ... u4 code_length; + ... u1 code[code_length]; + (binaryF.binary_32 (the #code code)) + ... u2 exception_table_length; + ... exception_table[exception_table_length]; + ((binaryF.sequence_16 /exception.writer) (the #exception_table code)) + ... u2 attributes_count; + ... attribute_info attributes[attributes_count]; + ((binaryF.sequence_16 writer) (the #attributes code)) + )) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux index 6dc9cade9..649049e0b 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code/exception.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}]] - [data - ["[0]" product] - ["[0]" format "_" - ["[1]" binary {"+" Writer}]]] - [math - [number - ["n" nat]]]]] - ["[0]" // "_" - ["//[1]" /// "_" - [constant {"+" Class}] - ["[1][0]" index {"+" Index}] - [bytecode - ["[1][0]" address {"+" Address}]] - [encoding - ["[1][0]" unsigned {"+" U2}]]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}]] + [data + ["[0]" product] + ["[0]" format "_" + ["[1]" binary {"+" Writer}]]] + [math + [number + ["n" nat]]]]] + ["[0]" // "_" + ["//[1]" /// "_" + [constant {"+" Class}] + ["[1][0]" index {"+" Index}] + [bytecode + ["[1][0]" address {"+" Address}]] + [encoding + ["[1][0]" unsigned {"+" U2}]]]]) (type: .public Exception (Record @@ -28,32 +28,32 @@ (def: .public equivalence (Equivalence Exception) - ($_ product.equivalence - ////address.equivalence - ////address.equivalence - ////address.equivalence - ////index.equivalence - )) + (all product.equivalence + ////address.equivalence + ////address.equivalence + ////address.equivalence + ////index.equivalence + )) ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 (def: .public length Nat - ($_ n.+ - ... u2 start_pc; - ////unsigned.bytes/2 - ... u2 end_pc; - ////unsigned.bytes/2 - ... u2 handler_pc; - ////unsigned.bytes/2 - ... u2 catch_type; - ////unsigned.bytes/2 - )) + (all n.+ + ... u2 start_pc; + ////unsigned.bytes/2 + ... u2 end_pc; + ////unsigned.bytes/2 + ... u2 handler_pc; + ////unsigned.bytes/2 + ... u2 catch_type; + ////unsigned.bytes/2 + )) (def: .public writer (Writer Exception) - ($_ format.and - ////address.writer - ////address.writer - ////address.writer - ////index.writer - )) + (all format.and + ////address.writer + ////address.writer + ////address.writer + ////index.writer + )) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux index 3d3bb2d8d..eb98b1262 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit.lux @@ -38,22 +38,22 @@ ) (def: .public length - ($_ n.+ - ... u2 max_stack; - /stack.length - ... u2 max_locals; - /registry.length)) + (all n.+ + ... u2 max_stack; + /stack.length + ... u2 max_locals; + /registry.length)) (def: .public equivalence (Equivalence Limit) - ($_ product.equivalence - /stack.equivalence - /registry.equivalence - )) + (all product.equivalence + /stack.equivalence + /registry.equivalence + )) (def: .public (writer limit) (Writer Limit) - ($_ format#composite - (/stack.writer (the #stack limit)) - (/registry.writer (the #registry limit)) - )) + (all format#composite + (/stack.writer (the #stack limit)) + (/registry.writer (the #registry limit)) + )) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 379adfd35..61201beb5 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -578,14 +578,14 @@ (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] (let [estimator (is (-> Nat Estimator) (function (_ amount_of_afterwards offset) - (|> ($_ n.+ - (///unsigned.value ..opcode_size) - (switch_padding (///unsigned.value (//address.value offset))) - (///unsigned.value ..big_jump_size) - (///unsigned.value ..integer_size) - (///unsigned.value ..integer_size) - (n.* (///unsigned.value ..big_jump_size) - (++ amount_of_afterwards))) + (|> (all n.+ + (///unsigned.value ..opcode_size) + (switch_padding (///unsigned.value (//address.value offset))) + (///unsigned.value ..big_jump_size) + (///unsigned.value ..integer_size) + (///unsigned.value ..integer_size) + (n.* (///unsigned.value ..big_jump_size) + (++ amount_of_afterwards))) ///unsigned.u2 try.trusted)))] [estimator @@ -644,12 +644,12 @@ (///unsigned.value ..big_jump_size)) estimator (is (-> Nat Estimator) (function (_ amount_of_cases offset) - (|> ($_ n.+ - (///unsigned.value ..opcode_size) - (switch_padding (///unsigned.value (//address.value offset))) - (///unsigned.value ..big_jump_size) - (///unsigned.value ..integer_size) - (n.* amount_of_cases case_size)) + (|> (all n.+ + (///unsigned.value ..opcode_size) + (switch_padding (///unsigned.value (//address.value offset))) + (///unsigned.value ..big_jump_size) + (///unsigned.value ..integer_size) + (n.* amount_of_cases case_size)) ///unsigned.u2 try.trusted)))] [estimator diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 8447c56de..cd459643a 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -58,18 +58,18 @@ (def: .public equivalence (Equivalence Class) - ($_ product.equivalence - //unsigned.equivalence - //unsigned.equivalence - //unsigned.equivalence - //pool.equivalence - //modifier.equivalence - //index.equivalence - //index.equivalence - (sequence.equivalence //index.equivalence) - (sequence.equivalence //field.equivalence) - (sequence.equivalence //method.equivalence) - (sequence.equivalence //attribute.equivalence))) + (all product.equivalence + //unsigned.equivalence + //unsigned.equivalence + //unsigned.equivalence + //pool.equivalence + //modifier.equivalence + //index.equivalence + //index.equivalence + (sequence.equivalence //index.equivalence) + (sequence.equivalence //field.equivalence) + (sequence.equivalence //method.equivalence) + (sequence.equivalence //attribute.equivalence))) (def: (install_classes this super interfaces) (-> Internal Internal (List Internal) @@ -128,23 +128,23 @@ (def: .public (writer class) (Writer Class) - (`` ($_ binaryF#composite - (~~ (template [<writer> <slot>] - [(<writer> (the <slot> class))] + (`` (all binaryF#composite + (~~ (template [<writer> <slot>] + [(<writer> (the <slot> class))] - [//magic.writer #magic] - [//version.writer #minor_version] - [//version.writer #major_version] - [//pool.writer #constant_pool] - [//modifier.writer #modifier] - [//index.writer #this] - [//index.writer #super])) - (~~ (template [<writer> <slot>] - [((binaryF.sequence_16 <writer>) (the <slot> class))] + [//magic.writer #magic] + [//version.writer #minor_version] + [//version.writer #major_version] + [//pool.writer #constant_pool] + [//modifier.writer #modifier] + [//index.writer #this] + [//index.writer #super])) + (~~ (template [<writer> <slot>] + [((binaryF.sequence_16 <writer>) (the <slot> class))] - [//index.writer #interfaces] - [//field.writer #fields] - [//method.writer #methods] - [//attribute.writer #attributes] - )) - ))) + [//index.writer #interfaces] + [//field.writer #fields] + [//method.writer #methods] + [//attribute.writer #attributes] + )) + ))) diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index c32ca731c..230157059 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -140,15 +140,15 @@ (template [<type> <equivalence> <writer>] [(def: .public <equivalence> (Equivalence (<type> Any)) - ($_ product.equivalence - //index.equivalence - //index.equivalence)) + (all product.equivalence + //index.equivalence + //index.equivalence)) (def: <writer> (Writer (<type> Any)) - ($_ binaryF.and - //index.writer - //index.writer))] + (all binaryF.and + //index.writer + //index.writer))] [Name_And_Type name_and_type_equivalence name_and_type_writer] [Reference reference_equivalence reference_writer] @@ -201,7 +201,7 @@ _ false))) - ... ($_ sum.equivalence + ... (all sum.equivalence ... ... #UTF8 ... text.equivalence ... ... #Long diff --git a/stdlib/source/library/lux/target/jvm/field.lux b/stdlib/source/library/lux/target/jvm/field.lux index 5db3ac6b0..d97951fbf 100644 --- a/stdlib/source/library/lux/target/jvm/field.lux +++ b/stdlib/source/library/lux/target/jvm/field.lux @@ -42,23 +42,23 @@ (def: .public equivalence (Equivalence Field) - ($_ product.equivalence - modifier.equivalence - //index.equivalence - //index.equivalence - (sequence.equivalence //attribute.equivalence))) + (all product.equivalence + modifier.equivalence + //index.equivalence + //index.equivalence + (sequence.equivalence //attribute.equivalence))) (def: .public (writer field) (Writer Field) - (`` ($_ binaryF#composite - (~~ (template [<writer> <slot>] - [(<writer> (the <slot> field))] + (`` (all binaryF#composite + (~~ (template [<writer> <slot>] + [(<writer> (the <slot> field))] - [modifier.writer #modifier] - [//index.writer #name] - [//index.writer #descriptor] - [(binaryF.sequence_16 //attribute.writer) #attributes])) - ))) + [modifier.writer #modifier] + [//index.writer #name] + [//index.writer #descriptor] + [(binaryF.sequence_16 //attribute.writer) #attributes])) + ))) (def: .public (field modifier name with_signature? type attributes) (-> (Modifier Field) UTF8 Bit (Type Value) (Sequence Attribute) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index cac656214..193bb4db8 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -89,21 +89,21 @@ (def: .public equivalence (Equivalence Method) - ($_ product.equivalence - //modifier.equivalence - //index.equivalence - //index.equivalence - (sequence.equivalence //attribute.equivalence) - )) + (all product.equivalence + //modifier.equivalence + //index.equivalence + //index.equivalence + (sequence.equivalence //attribute.equivalence) + )) (def: .public (writer field) (Writer Method) - (`` ($_ format#composite - (~~ (template [<writer> <slot>] - [(<writer> (the <slot> field))] + (`` (all format#composite + (~~ (template [<writer> <slot>] + [(<writer> (the <slot> field))] - [//modifier.writer #modifier] - [//index.writer #name] - [//index.writer #descriptor] - [(format.sequence_16 //attribute.writer) #attributes])) - ))) + [//modifier.writer #modifier] + [//index.writer #name] + [//index.writer #descriptor] + [(format.sequence_16 //attribute.writer) #attributes])) + ))) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index 9c802f924..39f8aba69 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -1,28 +1,28 @@ (.using - [library - [lux {"-" Type Primitive int char type parameter} - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" maybe] - ["[0]" try] - ["[0]" exception {"+" exception:}] - ["<>" parser - ["<[0]>" text {"+" Parser}]]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary {"+" Dictionary}]]]]] - ["[0]" // {"+" Type} - [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter}] - ["[1][0]" descriptor] - ["[1][0]" signature {"+" Signature}] - ["[1][0]" reflection] - ["[1][0]" parser] - ["/[1]" // "_" - [encoding - ["[1][0]" name]]]]) + [library + [lux {"-" Type Primitive int char type parameter} + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" maybe] + ["[0]" try] + ["[0]" exception {"+" exception:}] + ["<>" parser + ["<[0]>" text {"+" Parser}]]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary {"+" Dictionary}]]]]] + ["[0]" // {"+" Type} + [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter}] + ["[1][0]" descriptor] + ["[1][0]" signature {"+" Signature}] + ["[1][0]" reflection] + ["[1][0]" parser] + ["/[1]" // "_" + [encoding + ["[1][0]" name]]]]) (type: .public Aliasing (Dictionary Text Text)) @@ -67,23 +67,23 @@ (<>.rec (function (_ parameter) (let [class (..class parameter)] - ($_ <>.either - (..var aliasing) - //parser.wildcard - (..lower class) - (..upper class) - class - ))))) + (all <>.either + (..var aliasing) + //parser.wildcard + (..lower class) + (..upper class) + class + ))))) (def: (value aliasing) (-> Aliasing (Parser (Type Value))) (<>.rec (function (_ value) - ($_ <>.either - //parser.primitive - (parameter aliasing) - (//parser.array' value) - )))) + (all <>.either + //parser.primitive + (parameter aliasing) + (//parser.array' value) + )))) (def: (inputs aliasing) (-> Aliasing (Parser (List (Type Value)))) @@ -93,10 +93,10 @@ (def: (return aliasing) (-> Aliasing (Parser (Type Return))) - ($_ <>.either - //parser.void - (..value aliasing) - )) + (all <>.either + //parser.void + (..value aliasing) + )) (def: (exception aliasing) (-> Aliasing (Parser (Type Class))) diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index c608b7a94..60960123d 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -85,29 +85,29 @@ (def: primitive (Parser (Check Type)) - ($_ <>.either - ..boolean - ..byte - ..short - ..int - ..long - ..float - ..double - ..char - )) + (all <>.either + ..boolean + ..byte + ..short + ..int + ..long + ..float + ..double + ..char + )) (def: boxed_primitive (Parser (Check Type)) - ($_ <>.either - ..boxed_boolean - ..boxed_byte - ..boxed_short - ..boxed_int - ..boxed_long - ..boxed_float - ..boxed_double - ..boxed_char - )) + (all <>.either + ..boxed_boolean + ..boxed_byte + ..boxed_short + ..boxed_int + ..boxed_long + ..boxed_float + ..boxed_double + ..boxed_char + )) (def: wildcard (Parser (Check Type)) @@ -157,13 +157,13 @@ (<>.rec (function (_ parameter) (let [class (..class' parameter)] - ($_ <>.either - (..var mapping) - ..wildcard - (..lower class) - (..upper class) - class - ))))) + (all <>.either + (..var mapping) + ..wildcard + (..lower class) + (..upper class) + class + ))))) (def: .public class (-> Mapping (Parser (Check Type))) @@ -196,35 +196,35 @@ (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) - ($_ <>.either - ..primitive - (parameter mapping) - (..array type) - )))) + (all <>.either + ..primitive + (parameter mapping) + (..array type) + )))) (def: .public (boxed_type mapping) (-> Mapping (Parser (Check Type))) (<>.rec (function (_ type) - ($_ <>.either - ..boxed_primitive - (parameter mapping) - (..array type) - )))) + (all <>.either + ..boxed_primitive + (parameter mapping) + (..array type) + )))) (def: .public (return mapping) (-> Mapping (Parser (Check Type))) - ($_ <>.either - ..void - (..type mapping) - )) + (all <>.either + ..void + (..type mapping) + )) (def: .public (boxed_return mapping) (-> Mapping (Parser (Check Type))) - ($_ <>.either - ..void - (..boxed_type mapping) - )) + (all <>.either + ..void + (..boxed_type mapping) + )) (def: .public (check operation input) (All (_ a) (-> (Parser (Check a)) Text (Check a))) diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index b576c8d5b..e7c2a2c70 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -42,16 +42,16 @@ (def: .public primitive (Parser (Type Primitive)) - ($_ <>.either - ..boolean - ..byte - ..short - ..int - ..long - ..float - ..double - ..char - )) + (all <>.either + ..boolean + ..byte + ..short + ..int + ..long + ..float + ..double + ..char + )) (def: var/head (format "abcdefghijklmnopqrstuvwxyz" @@ -137,23 +137,23 @@ (<>.rec (function (_ parameter) (let [class (..class' parameter)] - ($_ <>.either - ..var - ..wildcard - (..lower parameter) - (..upper parameter) - (..array' value) - class - ))))) + (all <>.either + ..var + ..wildcard + (..lower parameter) + (..upper parameter) + (..array' value) + class + ))))) (def: .public value (Parser (Type Value)) (<>.rec (function (_ value) - ($_ <>.either - ..primitive - (..parameter' value) - )))) + (all <>.either + ..primitive + (..parameter' value) + )))) (def: .public parameter (Parser (Type Parameter)) @@ -188,9 +188,9 @@ (def: .public object (Parser (Type Object)) - ($_ <>.either - ..class - ..array)) + (all <>.either + ..class + ..array)) (def: inputs (|> (<>.some ..value) @@ -225,14 +225,14 @@ (List (Type Value)) (Type Return) (List (Type Class))]) - ($_ <>.and - (|> (<>.some (<>#each product.left ..var_declaration)) - (<>.after (<text>.this //signature.parameters_start)) - (<>.before (<text>.this //signature.parameters_end)) - (<>.else (list))) - ..inputs - ..return - (<>.some ..exception)))] + (all <>.and + (|> (<>.some (<>#each product.left ..var_declaration)) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) + (<>.else (list))) + ..inputs + ..return + (<>.some ..exception)))] (|>> //.signature //signature.signature (<text>.result parser) diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 1d8bf0de5..c03676e09 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -139,11 +139,11 @@ utc_second ..second_parser utc_millis ..millis_parser] (in (abstraction - ($_ n.+ - (n.* utc_hour hour) - (n.* utc_minute minute) - (n.* utc_second second) - (n.* utc_millis millis))))))) + (all n.+ + (n.* utc_hour hour) + (n.* utc_minute minute) + (n.* utc_second second) + (n.* utc_millis millis))))))) ) (def: (padded value) @@ -161,10 +161,10 @@ (def: (millis_format millis) (-> Nat Text) (cond (n.= 0 millis) "" - (n.< 10 millis) ($_ text#composite ".00" (n#encoded millis)) - (n.< 100 millis) ($_ text#composite ".0" (n#encoded millis)) + (n.< 10 millis) (all text#composite ".00" (n#encoded millis)) + (n.< 100 millis) (all text#composite ".0" (n#encoded millis)) ... (n.< 1,000 millis) - ($_ text#composite "." (n#encoded millis)))) + (all text#composite "." (n#encoded millis)))) (type: .public Clock (Record @@ -189,11 +189,11 @@ (def: .public (time clock) (-> Clock (Try Time)) - (|> ($_ duration.composite - (duration.up (the #hour clock) duration.hour) - (duration.up (the #minute clock) duration.minute) - (duration.up (the #second clock) duration.second) - (duration.of_millis (.int (the #milli_second clock)))) + (|> (all duration.composite + (duration.up (the #hour clock) duration.hour) + (duration.up (the #minute clock) duration.minute) + (duration.up (the #second clock) duration.second) + (duration.of_millis (.int (the #milli_second clock)))) duration.millis .nat ..of_millis)) @@ -201,11 +201,11 @@ (def: (format time) (-> Time Text) (let [(open "_[0]") (..clock time)] - ($_ text#composite - (..padded _#hour) - ..separator (..padded _#minute) - ..separator (..padded _#second) - (..millis_format _#milli_second)))) + (all text#composite + (..padded _#hour) + ..separator (..padded _#minute) + ..separator (..padded _#second) + (..millis_format _#milli_second)))) (implementation: .public codec (Codec Text Time) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index c19df3444..d47ed902c 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -184,10 +184,10 @@ (def: (format value) (-> Date Text) - ($_ text#composite - (# //year.codec encoded (..year value)) - ..separator (..padded (|> value ..month //month.number)) - ..separator (..padded (..day_of_month value)))) + (all text#composite + (# //year.codec encoded (..year value)) + ..separator (..padded (|> value ..month //month.number)) + ..separator (..padded (..day_of_month value)))) (implementation: .public codec (Codec Text Date) diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index 1a5b0a10f..02926f610 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -153,10 +153,10 @@ (exception: .public (invalid_day [number Nat]) (exception.report "Number" (# n.decimal encoded number) - "Valid range" ($_ "lux text concat" - (# n.decimal encoded (..number {#Sunday})) - " ~ " - (# n.decimal encoded (..number {#Saturday}))))) + "Valid range" (all "lux text concat" + (# n.decimal encoded (..number {#Sunday})) + " ~ " + (# n.decimal encoded (..number {#Saturday}))))) (def: .public (by_number number) (-> Nat (Try Day)) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index 85e271547..84588ff83 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -127,10 +127,10 @@ (def: (encoded duration) (if (# ..equivalence = ..empty duration) - ($_ text#composite - ..positive_sign - (nat#encoded 0) - ..milli_second_suffix) + (all text#composite + ..positive_sign + (nat#encoded 0) + ..milli_second_suffix) (let [signed? (negative? duration) [days time_left] [(ticks day duration) (framed day duration)] days (if signed? @@ -143,14 +143,14 @@ [minutes time_left] [(ticks minute time_left) (framed minute time_left)] [seconds time_left] [(ticks second time_left) (framed second time_left)] millis (..millis time_left)] - ($_ text#composite - (if signed? ..negative_sign ..positive_sign) - (if (i.= +0 days) "" (text#composite (nat#encoded (.nat days)) ..day_suffix)) - (if (i.= +0 hours) "" (text#composite (nat#encoded (.nat hours)) ..hour_suffix)) - (if (i.= +0 minutes) "" (text#composite (nat#encoded (.nat minutes)) ..minute_suffix)) - (if (i.= +0 seconds) "" (text#composite (nat#encoded (.nat seconds)) ..second_suffix)) - (if (i.= +0 millis) "" (text#composite (nat#encoded (.nat millis)) ..milli_second_suffix)) - )))) + (all text#composite + (if signed? ..negative_sign ..positive_sign) + (if (i.= +0 days) "" (text#composite (nat#encoded (.nat days)) ..day_suffix)) + (if (i.= +0 hours) "" (text#composite (nat#encoded (.nat hours)) ..hour_suffix)) + (if (i.= +0 minutes) "" (text#composite (nat#encoded (.nat minutes)) ..minute_suffix)) + (if (i.= +0 seconds) "" (text#composite (nat#encoded (.nat seconds)) ..second_suffix)) + (if (i.= +0 millis) "" (text#composite (nat#encoded (.nat millis)) ..milli_second_suffix)) + )))) (def: parser (Parser Duration) diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index d32879232..5ba290670 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -123,9 +123,9 @@ (-> Instant Text) (let [[date time] (..date_time instant) time (..clock_time time)] - ($_ text#composite - (# date.codec encoded date) ..date_suffix - (# //.codec encoded time) ..time_suffix))) + (all text#composite + (# date.codec encoded date) ..date_suffix + (# //.codec encoded time) ..time_suffix))) (def: parser (Parser Instant) diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux index 503780519..351a6ecf7 100644 --- a/stdlib/source/library/lux/time/month.lux +++ b/stdlib/source/library/lux/time/month.lux @@ -81,10 +81,10 @@ (exception: .public (invalid_month [number Nat]) (exception.report "Number" (# n.decimal encoded number) - "Valid range" ($_ "lux text concat" - (# n.decimal encoded (..number {#January})) - " ~ " - (# n.decimal encoded (..number {#December}))))) + "Valid range" (all "lux text concat" + (# n.decimal encoded (..number {#January})) + " ~ " + (# n.decimal encoded (..number {#December}))))) (def: .public (by_number number) (-> Nat (Try Month)) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 4937ec9c1..ac43de9f2 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -100,13 +100,13 @@ (All (_ a) (-> (Writer a) (Writer [(module.Module a) Registry]))) - ($_ _.and - ($_ _.and - _.nat - descriptor.writer - (document.writer //)) - registry.writer - )) + (all _.and + (all _.and + _.nat + descriptor.writer + (document.writer //)) + registry.writer + )) (def: (cache_module context platform @module key format entry) (All (_ <type_vars> document) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index f237ebeae..eb6cd78d7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -23,80 +23,80 @@ (def: .public writer (Writer .Module) (let [definition (is (Writer Definition) - ($_ _.and _.bit _.type _.any)) + (all _.and _.bit _.type _.any)) labels (is (Writer [Text (List Text)]) (_.and _.text (_.list _.text))) global_type (is (Writer [Bit Type (Either [Text (List Text)] [Text (List Text)])]) - ($_ _.and _.bit _.type (_.or labels labels))) + (all _.and _.bit _.type (_.or labels labels))) global_label (is (Writer .Label) - ($_ _.and _.bit _.type (_.list _.text) _.nat)) + (all _.and _.bit _.type (_.list _.text) _.nat)) alias (is (Writer Alias) (_.and _.text _.text)) global (is (Writer Global) - ($_ _.or - definition - global_type - global_label - global_label - alias))] - ($_ _.and - ... #module_hash - _.nat - ... #module_aliases - (_.list alias) - ... #definitions - (_.list (_.and _.text global)) - ... #imports - (_.list _.text) - ... #module_state - _.any))) + (all _.or + definition + global_type + global_label + global_label + alias))] + (all _.and + ... #module_hash + _.nat + ... #module_aliases + (_.list alias) + ... #definitions + (_.list (_.and _.text global)) + ... #imports + (_.list _.text) + ... #module_state + _.any))) (def: .public parser (Parser .Module) (let [definition (is (Parser Definition) - ($_ <>.and - <binary>.bit - <binary>.type - <binary>.any)) + (all <>.and + <binary>.bit + <binary>.type + <binary>.any)) labels (is (Parser [Text (List Text)]) - ($_ <>.and - <binary>.text - (<binary>.list <binary>.text))) + (all <>.and + <binary>.text + (<binary>.list <binary>.text))) global_type (is (Parser [Bit Type (Either [Text (List Text)] [Text (List Text)])]) - ($_ <>.and - <binary>.bit - <binary>.type - (<binary>.or labels labels))) - global_label (is (Parser .Label) - ($_ <>.and + (all <>.and <binary>.bit <binary>.type - (<binary>.list <binary>.text) - <binary>.nat)) + (<binary>.or labels labels))) + global_label (is (Parser .Label) + (all <>.and + <binary>.bit + <binary>.type + (<binary>.list <binary>.text) + <binary>.nat)) alias (is (Parser Alias) - ($_ <>.and - <binary>.text - <binary>.text)) + (all <>.and + <binary>.text + <binary>.text)) global (is (Parser Global) - ($_ <binary>.or - definition - global_type - global_label - global_label - alias))] - ($_ <>.and - ... #module_hash - <binary>.nat - ... #module_aliases - (<binary>.list alias) - ... #definitions - (<binary>.list (<>.and <binary>.text global)) - ... #imports - (<binary>.list <binary>.text) - ... #module_state - (# <>.monad in {.#Cached})))) + (all <binary>.or + definition + global_type + global_label + global_label + alias))] + (all <>.and + ... #module_hash + <binary>.nat + ... #module_aliases + (<binary>.list alias) + ... #definitions + (<binary>.list (<>.and <binary>.text global)) + ... #imports + (<binary>.list <binary>.text) + ... #module_state + (# <>.monad in {.#Cached})))) (def: .public key (Key .Module) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/complex.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/complex.lux index 738795545..f4cf115d5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/complex.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/complex.lux @@ -75,14 +75,14 @@ (def: (hash value) (case value {#Variant [lefts right? value]} - ($_ n.* 2 - (# n.hash hash lefts) - (# bit.hash hash right?) - (# super hash value)) + (all n.* 2 + (# n.hash hash lefts) + (# bit.hash hash right?) + (# super hash value)) {#Tuple members} - ($_ n.* 3 - (# (list.hash super) hash members)) + (all n.* 3 + (# (list.hash super) hash members)) ))) (def: .public (format %it it) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux index 578cad62c..040298209 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux @@ -2,7 +2,7 @@ [library [lux {"-" local} [abstract - monad] + [monad {"+" do}]] [control ["[0]" maybe ("[1]#[0]" monad)] ["[0]" try] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux index 5bdfe1718..6416fbe77 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -3,7 +3,7 @@ [lux {"-" function} ["[0]" meta] [abstract - monad] + [monad {"+" do}]] [control ["[0]" maybe] ["[0]" try] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 6f23ba667..e5f1914ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -3,7 +3,7 @@ [lux "*" ["[0]" meta] [abstract - monad] + [monad {"+" do}]] [control ["[0]" exception {"+" exception:}]] [data diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 1d0c1f86b..39a8ef632 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -76,7 +76,7 @@ (def: array::write Handler (custom - [($_ <>.and <code>.any <code>.any <code>.any) + [(all <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -95,7 +95,7 @@ (def: array::delete Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -123,7 +123,7 @@ (def: object::new Handler (custom - [($_ <>.and <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [constructorC inputsC]) (do [! phase.monad] [constructorA (analysis/type.expecting Any @@ -135,7 +135,7 @@ (def: object::get Handler (custom - [($_ <>.and <code>.text <code>.any) + [(all <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.expecting Any @@ -147,7 +147,7 @@ (def: object::do Handler (custom - [($_ <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (analysis/type.expecting Any @@ -183,7 +183,7 @@ (def: js::apply Handler (custom - [($_ <>.and <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.expecting Any @@ -206,7 +206,7 @@ (def: js::function Handler (custom - [($_ <>.and <code>.nat <code>.any) + [(all <>.and <code>.nat <code>.any) (function (_ extension phase archive [arity abstractionC]) (do phase.monad [.let [inputT (type.tuple (list.repeated arity Any))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 3547f8029..6a54bf8e5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -231,7 +231,7 @@ (def: member (Parser Member) - ($_ <>.and <code>.text <code>.text)) + (all <>.and <code>.text <code>.text)) (type: Method_Signature (Record @@ -918,7 +918,7 @@ (def: (object::instance? class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and <code>.text <code>.any) + [(all <>.and <code>.text <code>.any) (function (_ extension_name analyse archive [sub_class objectC]) (do phase.monad [_ (..ensure_fresh_class! class_loader sub_class) @@ -1070,7 +1070,7 @@ (def: (put::static class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..member <code>.any) + [(all <>.and ..member <code>.any) (function (_ extension_name analyse archive [[class field] valueC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1095,7 +1095,7 @@ (def: (get::virtual class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..member <code>.any) + [(all <>.and ..member <code>.any) (function (_ extension_name analyse archive [[class field] objectC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1120,7 +1120,7 @@ (def: (put::virtual class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..member <code>.any <code>.any) + [(all <>.and ..member <code>.any <code>.any) (function (_ extension_name analyse archive [[class field] valueC objectC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1516,7 +1516,7 @@ (def: (invoke::static class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..type_vars ..member ..type_vars (<>.some ..input)) + [(all <>.and ..type_vars ..member ..type_vars (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars argsTC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1534,7 +1534,7 @@ (def: (invoke::virtual class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) + [(all <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars objectC argsTC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1559,7 +1559,7 @@ (def: (invoke::special class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) + [(all <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars objectC argsTC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1584,7 +1584,7 @@ (def: (invoke::interface class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) + [(all <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class_name method] method_tvars objectC argsTC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class_name) @@ -1613,7 +1613,7 @@ (def: (invoke::constructor class_loader) (-> java/lang/ClassLoader Handler) (..custom - [($_ <>.and ..type_vars <code>.text ..type_vars (<>.some ..input)) + [(all <>.and ..type_vars <code>.text ..type_vars (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars class method_tvars argsTC]) (do phase.monad [_ (..ensure_fresh_class! class_loader class) @@ -1781,12 +1781,12 @@ (def: .public visibility' (<text>.Parser Visibility) - ($_ <>.or - (<text>.this ..public_tag) - (<text>.this ..private_tag) - (<text>.this ..protected_tag) - (<text>.this ..default_tag) - )) + (all <>.or + (<text>.this ..public_tag) + (<text>.this ..private_tag) + (<text>.this ..protected_tag) + (<text>.this ..default_tag) + )) (def: .public visibility (Parser Visibility) @@ -1826,14 +1826,14 @@ (Parser (Abstract_Method Code)) (<| <code>.form (<>.after (<code>.this_text ..abstract_tag)) - ($_ <>.and - <code>.text - ..visibility - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - (<code>.tuple (<>.some ..argument)) - ..return - (<code>.tuple (<>.some ..class))))) + (all <>.and + <code>.text + ..visibility + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + (<code>.tuple (<>.some ..argument)) + ..return + (<code>.tuple (<>.some ..class))))) (def: (method_mapping of_class parameters) (-> Mapping (List (Type Var)) (Check Mapping)) @@ -1888,16 +1888,16 @@ (Parser (Constructor Code)) (<| <code>.form (<>.after (<code>.this_text ..constructor_tag)) - ($_ <>.and - ..visibility - <code>.bit - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - (<code>.tuple (<>.some ..class)) - <code>.text - (<code>.tuple (<>.some ..argument)) - (<code>.tuple (<>.some ..input)) - <code>.any))) + (all <>.and + ..visibility + <code>.bit + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + (<code>.tuple (<>.some ..class)) + <code>.text + (<code>.tuple (<>.some ..argument)) + (<code>.tuple (<>.some ..input)) + <code>.any))) (def: .public (analyse_constructor_method analyse archive selfT mapping method) (-> Phase Archive .Type Mapping (Constructor Code) (Operation Analysis)) @@ -1968,18 +1968,18 @@ (Parser (Virtual_Method Code)) (<| <code>.form (<>.after (<code>.this_text ..virtual_tag)) - ($_ <>.and - <code>.text - ..visibility - <code>.bit - <code>.bit - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - <code>.text - (<code>.tuple (<>.some ..argument)) - ..return - (<code>.tuple (<>.some ..class)) - <code>.any))) + (all <>.and + <code>.text + ..visibility + <code>.bit + <code>.bit + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + <code>.text + (<code>.tuple (<>.some ..argument)) + ..return + (<code>.tuple (<>.some ..class)) + <code>.any))) (type: .public (Method_Declaration a) (Record @@ -1993,14 +1993,14 @@ (def: .public method_declaration (Parser (Method_Declaration Code)) (<code>.form - ($_ <>.and - <code>.text - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - (<code>.tuple (<>.some ..class)) - (<code>.tuple (<>.some ..type)) - ..return - ))) + (all <>.and + <code>.text + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + (<code>.tuple (<>.some ..class)) + (<code>.tuple (<>.some ..type)) + ..return + ))) (def: .public (analyse_virtual_method analyse archive selfT mapping method) (-> Phase Archive .Type Mapping (Virtual_Method Code) (Operation Analysis)) @@ -2066,16 +2066,16 @@ (Parser (Static_Method Code)) (<| <code>.form (<>.after (<code>.this_text ..static_tag)) - ($_ <>.and - <code>.text - ..visibility - <code>.bit - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - (<code>.tuple (<>.some ..argument)) - ..return - (<code>.tuple (<>.some ..class)) - <code>.any))) + (all <>.and + <code>.text + ..visibility + <code>.bit + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + (<code>.tuple (<>.some ..argument)) + ..return + (<code>.tuple (<>.some ..class)) + <code>.any))) (def: .public (analyse_static_method analyse archive mapping method) (-> Phase Archive Mapping (Static_Method Code) (Operation Analysis)) @@ -2140,18 +2140,18 @@ (Parser (Overriden_Method Code)) (<| <code>.form (<>.after (<code>.this_text ..overriden_tag)) - ($_ <>.and - ..class - <code>.text - <code>.bit - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..var)) - <code>.text - (<code>.tuple (<>.some ..argument)) - ..return - (<code>.tuple (<>.some ..class)) - <code>.any - ))) + (all <>.and + ..class + <code>.text + <code>.bit + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..var)) + <code>.text + (<code>.tuple (<>.some ..argument)) + ..return + (<code>.tuple (<>.some ..class)) + <code>.any + ))) (exception: .public (unknown_super [name Text supers (List (Type Class))]) @@ -2396,9 +2396,9 @@ (try#each (|>> (format.result class.writer) [name]) (class.class version.v6_0 - ($_ modifier#composite - class.public - modifier) + (all modifier#composite + class.public + modifier) (name.internal name) {.#Some signature} (..class_name super) @@ -2409,11 +2409,11 @@ (def: constant::modifier (Modifier field.Field) - ($_ modifier#composite - field.public - field.static - field.final - )) + (all modifier#composite + field.public + field.static + field.final + )) (def: (field_definition field) (-> Field (Resource field.Field)) @@ -2484,24 +2484,24 @@ _.return {.#Left valueT} - ($_ _.composite - (mock_value valueT) - (case (jvm.primitive? valueT) - {.#Left classT} - _.areturn - - {.#Right primitiveT} - (cond (# jvm.equivalence = jvm.long primitiveT) - _.lreturn + (all _.composite + (mock_value valueT) + (case (jvm.primitive? valueT) + {.#Left classT} + _.areturn + + {.#Right primitiveT} + (cond (# jvm.equivalence = jvm.long primitiveT) + _.lreturn - (# jvm.equivalence = jvm.float primitiveT) - _.freturn + (# jvm.equivalence = jvm.float primitiveT) + _.freturn - (# jvm.equivalence = jvm.double primitiveT) - _.dreturn + (# jvm.equivalence = jvm.double primitiveT) + _.dreturn - ... jvm.boolean jvm.byte jvm.short jvm.int jvm.char - _.ireturn))))) + ... jvm.boolean jvm.byte jvm.short jvm.int jvm.char + _.ireturn))))) (def: (mock_method super method) (-> (Type Class) (Method_Definition Code) (Resource method.Method)) @@ -2509,32 +2509,32 @@ {#Constructor [privacy strict_floating_point? annotations variables exceptions self arguments constructor_arguments body]} - (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty)) ..constructor_name #0 (jvm.method [variables (list#each product.right arguments) jvm.void exceptions]) (list) - {.#Some ($_ _.composite - (_.aload 0) - (|> constructor_arguments - (list#each (|>> product.left ..mock_value)) - (monad.all _.monad)) - (|> (jvm.method [(list) (list#each product.left constructor_arguments) jvm.void (list)]) - (_.invokespecial super ..constructor_name)) - _.return - )}) + {.#Some (all _.composite + (_.aload 0) + (|> constructor_arguments + (list#each (|>> product.left ..mock_value)) + (monad.all _.monad)) + (|> (jvm.method [(list) (list#each product.left constructor_arguments) jvm.void (list)]) + (_.invokespecial super ..constructor_name)) + _.return + )}) {#Overriden_Method [super name strict_floating_point? annotations variables self arguments return exceptions body]} - (method.method ($_ modifier#composite - method.public - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + method.public + (if strict_floating_point? + method.strict + modifier.empty)) name #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -2543,14 +2543,14 @@ {#Virtual_Method [name privacy final? strict_floating_point? annotations variables self arguments return exceptions body]} - (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty) - (if final? - method.final - modifier.empty)) + (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty) + (if final? + method.final + modifier.empty)) name #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -2559,12 +2559,12 @@ {#Static_Method [name privacy strict_floating_point? annotations variables arguments return exceptions body]} - (method.method ($_ modifier#composite - method.static - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + method.static + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty)) name #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -2572,9 +2572,9 @@ {#Abstract_Method [name privacy annotations variables arguments return exceptions]} - (method.method ($_ modifier#composite - method.abstract - (..method_privacy privacy)) + (method.method (all modifier#composite + method.abstract + (..method_privacy privacy)) name #0 (jvm.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -2594,12 +2594,12 @@ (def: (class::anonymous class_loader host) (-> java/lang/ClassLoader runtime.Host Handler) (..custom - [($_ <>.and - (<code>.tuple (<>.some ..var)) - ..class - (<code>.tuple (<>.some ..class)) - (<code>.tuple (<>.some ..input)) - (<code>.tuple (<>.some ..overriden_method_definition))) + [(all <>.and + (<code>.tuple (<>.some ..var)) + ..class + (<code>.tuple (<>.some ..class)) + (<code>.tuple (<>.some ..input)) + (<code>.tuple (<>.some ..overriden_method_definition))) (function (_ extension_name analyse archive [parameters super_class super_interfaces diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index a0e5d2a1c..6f5b62016 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -88,7 +88,7 @@ (def: array::write Handler (custom - [($_ <>.and <code>.any <code>.any <code>.any) + [(all <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -107,7 +107,7 @@ (def: array::delete Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -135,7 +135,7 @@ (def: object::get Handler (custom - [($_ <>.and <code>.text <code>.any) + [(all <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.expecting ..Object @@ -147,7 +147,7 @@ (def: object::do Handler (custom - [($_ <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (analysis/type.expecting ..Object @@ -204,7 +204,7 @@ (def: lua::apply Handler (custom - [($_ <>.and <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.expecting ..Function @@ -216,7 +216,7 @@ (def: lua::power Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [powerC baseC]) (do [! phase.monad] [powerA (analysis/type.expecting Frac @@ -238,7 +238,7 @@ (def: lua::function Handler (custom - [($_ <>.and <code>.nat <code>.any) + [(all <>.and <code>.nat <code>.any) (function (_ extension phase archive [arity abstractionC]) (do phase.monad [.let [inputT (type.tuple (list.repeated arity Any))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index bf2f53507..6ff97bb35 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -96,11 +96,11 @@ (def: lux::syntax_char_case! (..custom - [($_ <>.and - <code>.any - (<code>.tuple (<>.some (<>.and (<code>.tuple (<>.many ..text_char)) - <code>.any))) - <code>.any) + [(all <>.and + <code>.any + (<code>.tuple (<>.some (<>.and (<code>.tuple (<>.many ..text_char)) + <code>.any))) + <code>.any) (function (_ extension_name phase archive [input conditionals else]) (do [! ////.monad] [input (<| (typeA.expecting text.Char) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index 760db788c..6d7b0d128 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -72,7 +72,7 @@ (def: array::write Handler (custom - [($_ <>.and <c>.any <c>.any <c>.any) + [(all <>.and <c>.any <c>.any <c>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -89,7 +89,7 @@ (def: array::delete Handler (custom - [($_ <>.and <c>.any <c>.any) + [(all <>.and <c>.any <c>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -127,7 +127,7 @@ (def: object::new Handler (custom - [($_ <>.and <c>.text (<>.some <c>.any)) + [(all <>.and <c>.text (<>.some <c>.any)) (function (_ extension phase archive [constructor inputsC]) (do [! phase.monad] [inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) @@ -137,7 +137,7 @@ (def: object::get Handler (custom - [($_ <>.and <c>.text <c>.any) + [(all <>.and <c>.text <c>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.with_type ..Object @@ -149,7 +149,7 @@ (def: object::do Handler (custom - [($_ <>.and <c>.text <c>.any (<>.some <c>.any)) + [(all <>.and <c>.text <c>.any (<>.some <c>.any)) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (analysis/type.with_type ..Object @@ -183,7 +183,7 @@ (def: php::apply Handler (custom - [($_ <>.and <c>.any (<>.some <c>.any)) + [(all <>.and <c>.any (<>.some <c>.any)) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.with_type ..Function @@ -195,7 +195,7 @@ (def: php::pack Handler (custom - [($_ <>.and <c>.any <c>.any) + [(all <>.and <c>.any <c>.any) (function (_ extension phase archive [formatC dataC]) (do [! phase.monad] [formatA (analysis/type.with_type Text diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index ceecbce4f..9156e497b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -76,7 +76,7 @@ (def: array::write Handler (custom - [($_ <>.and <code>.any <code>.any <code>.any) + [(all <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -95,7 +95,7 @@ (def: array::delete Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -139,7 +139,7 @@ (def: object::get Handler (custom - [($_ <>.and <code>.text <code>.any) + [(all <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.expecting ..Object @@ -151,7 +151,7 @@ (def: object::do Handler (custom - [($_ <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (analysis/type.expecting ..Object @@ -193,7 +193,7 @@ (def: python::apply Handler (custom - [($_ <>.and <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.expecting ..Function @@ -205,7 +205,7 @@ (def: python::function Handler (custom - [($_ <>.and <code>.nat <code>.any) + [(all <>.and <code>.nat <code>.any) (function (_ extension phase archive [arity abstractionC]) (do phase.monad [.let [inputT (type.tuple (list.repeated arity Any))] @@ -218,7 +218,7 @@ (def: python::exec Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [codeC globalsC]) (do phase.monad [codeA (analysis/type.expecting Text diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index 8af81e312..9ab5d8351 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -76,7 +76,7 @@ (def: array::write Handler (custom - [($_ <>.and <code>.any <code>.any <code>.any) + [(all <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -95,7 +95,7 @@ (def: array::delete Handler (custom - [($_ <>.and <code>.any <code>.any) + [(all <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@read :read:])) @@ -135,7 +135,7 @@ (def: object::get Handler (custom - [($_ <>.and <code>.text <code>.any) + [(all <>.and <code>.text <code>.any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (<| (analysis/type.expecting ..Object) @@ -147,7 +147,7 @@ (def: object::do Handler (custom - [($_ <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.text <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (<| (analysis/type.expecting ..Object) @@ -180,7 +180,7 @@ (def: ruby::apply Handler (custom - [($_ <>.and <code>.any (<code>.tuple (<>.some <code>.any))) + [(all <>.and <code>.any (<code>.tuple (<>.some <code>.any))) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (<| (analysis/type.expecting ..Function) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index da2c2e828..fb119ae7e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -72,7 +72,7 @@ (def: array::write Handler (custom - [($_ <>.and <c>.any <c>.any <c>.any) + [(all <>.and <c>.any <c>.any <c>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -89,7 +89,7 @@ (def: array::delete Handler (custom - [($_ <>.and <c>.any <c>.any) + [(all <>.and <c>.any <c>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -140,7 +140,7 @@ (def: scheme::apply Handler (custom - [($_ <>.and <c>.any (<>.some <c>.any)) + [(all <>.and <c>.any (<>.some <c>.any)) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.with_type ..Function diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 0906183ef..1a30f6bc6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -111,14 +111,14 @@ (def: visibility' (<text>.Parser (Modifier field.Field)) - (`` ($_ <>.either - (~~ (template [<label> <modifier>] - [(<>.after (<text>.this <label>) (<>#in <modifier>))] + (`` (all <>.either + (~~ (template [<label> <modifier>] + [(<>.after (<text>.this <label>) (<>#in <modifier>))] - ["public" field.public] - ["private" field.private] - ["protected" field.protected] - ["default" modifier.empty]))))) + ["public" field.public] + ["private" field.private] + ["protected" field.protected] + ["default" modifier.empty]))))) (def: visibility (Parser (Modifier field.Field)) @@ -126,23 +126,23 @@ (def: inheritance (Parser (Modifier class.Class)) - (`` ($_ <>.either - (~~ (template [<label> <modifier>] - [(<>.after (<code>.this_text <label>) (<>#in <modifier>))] + (`` (all <>.either + (~~ (template [<label> <modifier>] + [(<>.after (<code>.this_text <label>) (<>#in <modifier>))] - ["final" class.final] - ["abstract" class.abstract] - ["default" modifier.empty]))))) + ["final" class.final] + ["abstract" class.abstract] + ["default" modifier.empty]))))) (def: state (Parser (Modifier field.Field)) - (`` ($_ <>.either - (~~ (template [<label> <modifier>] - [(<>.after (<code>.this_text <label>) (<>#in <modifier>))] + (`` (all <>.either + (~~ (template [<label> <modifier>] + [(<>.after (<code>.this_text <label>) (<>#in <modifier>))] - ["volatile" field.volatile] - ["final" field.final] - ["default" modifier.empty]))))) + ["volatile" field.volatile] + ["final" field.final] + ["default" modifier.empty]))))) (type: Annotation Any) @@ -161,12 +161,12 @@ (Parser Constant) (<| <code>.form (<>.after (<code>.this_text "constant")) - ($_ <>.and - <code>.text - (<code>.tuple (<>.some ..annotation)) - ..field_type - <code>.any - ))) + (all <>.and + <code>.text + (<code>.tuple (<>.some ..annotation)) + ..field_type + <code>.any + ))) (type: Variable [Text (Modifier field.Field) (Modifier field.Field) Bit (List Annotation) (Type Value)]) @@ -175,14 +175,14 @@ (Parser Variable) (<| <code>.form (<>.after (<code>.this_text "variable")) - ($_ <>.and - <code>.text - ..visibility - ..state - (<>.parses? (<code>.this_text jvm.static_tag)) - (<code>.tuple (<>.some ..annotation)) - ..field_type - ))) + (all <>.and + <code>.text + ..visibility + ..state + (<>.parses? (<code>.this_text jvm.static_tag)) + (<code>.tuple (<>.some ..annotation)) + ..field_type + ))) (type: Field (Variant @@ -191,10 +191,10 @@ (def: field (Parser Field) - ($_ <>.or - ..constant - ..variable - )) + (all <>.or + ..constant + ..variable + )) (type: (Method_Definition a) (Variant @@ -206,13 +206,13 @@ (def: method (Parser (Method_Definition Code)) - ($_ <>.or - jvm.constructor_definition - jvm.virtual_method_definition - jvm.static_method_definition - jvm.overriden_method_definition - jvm.abstract_method_definition - )) + (all <>.or + jvm.constructor_definition + jvm.virtual_method_definition + jvm.static_method_definition + jvm.overriden_method_definition + jvm.abstract_method_definition + )) (def: $Object (Type Class) @@ -220,10 +220,10 @@ (def: constant::modifier (Modifier field.Field) - ($_ modifier#composite - field.public - field.static - field.final)) + (all modifier#composite + field.public + field.static + field.final)) (def: (field_definition field) (-> Field (Resource field.Field)) @@ -254,12 +254,12 @@ ... TODO: Handle annotations. {#Variable [name visibility state static? annotations type]} - (field.field ($_ modifier#composite - (if static? - field.static - modifier.empty) - visibility - state) + (field.field (all modifier#composite + (if static? + field.static + modifier.empty) + visibility + state) name #1 type sequence.empty))) (def: annotation_parameter_synthesis @@ -295,114 +295,114 @@ (<synthesis>.function 1) (<synthesis>.loop (<>.exactly 0 <synthesis>.any)) <synthesis>.tuple - ($_ <>.either - (<| (<>.after (<synthesis>.this_text "")) - (<>#each (host.hidden_method_body arity)) - <synthesis>.any) - <synthesis>.any))) + (all <>.either + (<| (<>.after (<synthesis>.this_text "")) + (<>#each (host.hidden_method_body arity)) + <synthesis>.any) + <synthesis>.any))) (def: constructor_synthesis (<synthesis>.Parser (jvm.Constructor Synthesis)) (<| <synthesis>.tuple (<>.after (<synthesis>.this_text jvm.constructor_tag)) - ($_ <>.and - (<text>.then jvm.visibility' <synthesis>.text) - <synthesis>.bit - (<synthesis>.tuple (<>.some ..annotation_synthesis)) - (<synthesis>.tuple (<>.some ..var_type_synthesis)) - (<synthesis>.tuple (<>.some ..class_type_synthesis)) - <synthesis>.text - (do <>.monad - [args (<synthesis>.tuple (<>.some ..argument_synthesis))] - ($_ <>.and - (in args) - (<synthesis>.tuple (<>.some ..input_synthesis)) - (..method_body (list.size args)))) - ))) + (all <>.and + (<text>.then jvm.visibility' <synthesis>.text) + <synthesis>.bit + (<synthesis>.tuple (<>.some ..annotation_synthesis)) + (<synthesis>.tuple (<>.some ..var_type_synthesis)) + (<synthesis>.tuple (<>.some ..class_type_synthesis)) + <synthesis>.text + (do <>.monad + [args (<synthesis>.tuple (<>.some ..argument_synthesis))] + (all <>.and + (in args) + (<synthesis>.tuple (<>.some ..input_synthesis)) + (..method_body (list.size args)))) + ))) (def: overriden_method_synthesis (<synthesis>.Parser (jvm.Overriden_Method Synthesis)) (<| <synthesis>.tuple (<>.after (<synthesis>.this_text jvm.overriden_tag)) - ($_ <>.and - ..class_type_synthesis - <synthesis>.text - <synthesis>.bit - (<synthesis>.tuple (<>.some ..annotation_synthesis)) - (<synthesis>.tuple (<>.some ..var_type_synthesis)) - <synthesis>.text - (do <>.monad - [args (<synthesis>.tuple (<>.some ..argument_synthesis))] - ($_ <>.and - (in args) - ..return_type_synthesis - (<synthesis>.tuple (<>.some ..class_type_synthesis)) - (..method_body (list.size args)))) - ))) + (all <>.and + ..class_type_synthesis + <synthesis>.text + <synthesis>.bit + (<synthesis>.tuple (<>.some ..annotation_synthesis)) + (<synthesis>.tuple (<>.some ..var_type_synthesis)) + <synthesis>.text + (do <>.monad + [args (<synthesis>.tuple (<>.some ..argument_synthesis))] + (all <>.and + (in args) + ..return_type_synthesis + (<synthesis>.tuple (<>.some ..class_type_synthesis)) + (..method_body (list.size args)))) + ))) (def: virtual_method_synthesis (<synthesis>.Parser (jvm.Virtual_Method Synthesis)) (<| <synthesis>.tuple (<>.after (<synthesis>.this_text jvm.virtual_tag)) - ($_ <>.and - <synthesis>.text - (<text>.then jvm.visibility' <synthesis>.text) - <synthesis>.bit - <synthesis>.bit - (<synthesis>.tuple (<>.some ..annotation_synthesis)) - (<synthesis>.tuple (<>.some ..var_type_synthesis)) - <synthesis>.text - (do <>.monad - [args (<synthesis>.tuple (<>.some ..argument_synthesis))] - ($_ <>.and - (in args) - ..return_type_synthesis - (<synthesis>.tuple (<>.some ..class_type_synthesis)) - (..method_body (list.size args)))) - ))) + (all <>.and + <synthesis>.text + (<text>.then jvm.visibility' <synthesis>.text) + <synthesis>.bit + <synthesis>.bit + (<synthesis>.tuple (<>.some ..annotation_synthesis)) + (<synthesis>.tuple (<>.some ..var_type_synthesis)) + <synthesis>.text + (do <>.monad + [args (<synthesis>.tuple (<>.some ..argument_synthesis))] + (all <>.and + (in args) + ..return_type_synthesis + (<synthesis>.tuple (<>.some ..class_type_synthesis)) + (..method_body (list.size args)))) + ))) (def: static_method_synthesis (<synthesis>.Parser (jvm.Static_Method Synthesis)) (<| <synthesis>.tuple (<>.after (<synthesis>.this_text jvm.static_tag)) - ($_ <>.and - <synthesis>.text - (<text>.then jvm.visibility' <synthesis>.text) - <synthesis>.bit - (<synthesis>.tuple (<>.some ..annotation_synthesis)) - (<synthesis>.tuple (<>.some ..var_type_synthesis)) - (do <>.monad - [args (<synthesis>.tuple (<>.some ..argument_synthesis))] - ($_ <>.and - (in args) - ..return_type_synthesis - (<synthesis>.tuple (<>.some ..class_type_synthesis)) - (..method_body (list.size args)))) - ))) + (all <>.and + <synthesis>.text + (<text>.then jvm.visibility' <synthesis>.text) + <synthesis>.bit + (<synthesis>.tuple (<>.some ..annotation_synthesis)) + (<synthesis>.tuple (<>.some ..var_type_synthesis)) + (do <>.monad + [args (<synthesis>.tuple (<>.some ..argument_synthesis))] + (all <>.and + (in args) + ..return_type_synthesis + (<synthesis>.tuple (<>.some ..class_type_synthesis)) + (..method_body (list.size args)))) + ))) (def: abstract_method_synthesis (<synthesis>.Parser (jvm.Abstract_Method Synthesis)) (<| <synthesis>.tuple (<>.after (<synthesis>.this_text jvm.abstract_tag)) - ($_ <>.and - <synthesis>.text - (<text>.then jvm.visibility' <synthesis>.text) - (<synthesis>.tuple (<>.some ..annotation_synthesis)) - (<synthesis>.tuple (<>.some ..var_type_synthesis)) - (<synthesis>.tuple (<>.some ..argument_synthesis)) - ..return_type_synthesis - (<synthesis>.tuple (<>.some ..class_type_synthesis)) - ))) + (all <>.and + <synthesis>.text + (<text>.then jvm.visibility' <synthesis>.text) + (<synthesis>.tuple (<>.some ..annotation_synthesis)) + (<synthesis>.tuple (<>.some ..var_type_synthesis)) + (<synthesis>.tuple (<>.some ..argument_synthesis)) + ..return_type_synthesis + (<synthesis>.tuple (<>.some ..class_type_synthesis)) + ))) (def: method_synthesis (<synthesis>.Parser (Method_Definition Synthesis)) - ($_ <>.or - ..constructor_synthesis - ..virtual_method_synthesis - ..static_method_synthesis - ..overriden_method_synthesis - ..abstract_method_synthesis - )) + (all <>.or + ..constructor_synthesis + ..virtual_method_synthesis + ..static_method_synthesis + ..overriden_method_synthesis + ..abstract_method_synthesis + )) (def: composite (-> (List (Bytecode Any)) (Bytecode Any)) @@ -419,17 +419,17 @@ [(n.+ 1 jvm_register) (if (n.= lux_register jvm_register) (_#in []) - ($_ _.composite - (_.aload jvm_register) - (_.astore lux_register)))] + (all _.composite + (_.aload jvm_register) + (_.astore lux_register)))] {.#Right argumentT} (template.let [(wrap_primitive <shift> <load> <type>) [[(n.+ <shift> jvm_register) - ($_ _.composite - (<load> jvm_register) - (value.wrap <type>) - (_.astore lux_register))]]] + (all _.composite + (<load> jvm_register) + (value.wrap <type>) + (_.astore lux_register))]]] (`` (cond (~~ (template [<shift> <load> <type>] [(# type.equivalence = <type> argumentT) (wrap_primitive <shift> <load> <type>)] @@ -451,7 +451,7 @@ list.enumeration (list#mix (function (_ [lux_register type] [jvm_register before]) (let [[jvm_register' after] (method_argument (n.+ offset lux_register) type jvm_register)] - [jvm_register' ($_ _.composite before after)])) + [jvm_register' (all _.composite before after)])) (is [Register (Bytecode Any)] [offset (_#in [])])) product.right)) @@ -473,22 +473,22 @@ type.void (list)]) argumentsT (list#each product.right arguments)]] - (in (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty)) + (in (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty)) ..constructor_name #1 (type.method [method_tvars argumentsT type.void exceptions]) (list) - {.#Some ($_ _.composite - (_.aload 0) - (..composite constructor_argumentsG) - (_.invokespecial super_class ..constructor_name super_constructorT) - (method_arguments 1 argumentsT) - bodyG - _.return - )}))))) + {.#Some (all _.composite + (_.aload 0) + (..composite constructor_argumentsG) + (_.invokespecial super_class ..constructor_name super_constructorT) + (method_arguments 1 argumentsT) + bodyG + _.return + )}))))) (def: (method_return returnT) (-> (Type Return) (Bytecode Any)) @@ -501,18 +501,18 @@ {.#Left returnT} (case (type.class? returnT) {.#Some class_name} - ($_ _.composite - (_.checkcast returnT) - _.areturn) + (all _.composite + (_.checkcast returnT) + _.areturn) {.#None} _.areturn) {.#Right returnT} (template.let [(unwrap_primitive <return> <type>) - [($_ _.composite - (value.unwrap <type>) - <return>)]] + [(all _.composite + (value.unwrap <type>) + <return>)]] (`` (cond (~~ (template [<return> <type>] [(# type.equivalence = <type> returnT) (unwrap_primitive <return> <type>)] @@ -539,18 +539,18 @@ (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] - (in (method.method ($_ modifier#composite - method.public - (if strict_floating_point? - method.strict - modifier.empty)) + (in (method.method (all modifier#composite + method.public + (if strict_floating_point? + method.strict + modifier.empty)) method_name #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) - {.#Some ($_ _.composite - (method_arguments 1 argumentsT) - bodyG - (method_return returnJ))})))))) + {.#Some (all _.composite + (method_arguments 1 argumentsT) + bodyG + (method_return returnJ))})))))) (def: (virtual_method_generation archive method) (-> Archive (jvm.Virtual_Method Synthesis) (Operation (Resource Method))) @@ -563,21 +563,21 @@ (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] - (in (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty) - (if final? - method.final - modifier.empty)) + (in (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty) + (if final? + method.final + modifier.empty)) method_name #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) - {.#Some ($_ _.composite - (method_arguments 1 argumentsT) - bodyG - (method_return returnJ))})))))) + {.#Some (all _.composite + (method_arguments 1 argumentsT) + bodyG + (method_return returnJ))})))))) (def: (static_method_generation archive method) (-> Archive (jvm.Static_Method Synthesis) (Operation (Resource Method))) @@ -590,27 +590,27 @@ (do ! [bodyG (generate archive bodyS) .let [argumentsT (list#each product.right arguments)]] - (in (method.method ($_ modifier#composite - (..method_privacy privacy) - method.static - (if strict_floating_point? - method.strict - modifier.empty)) + (in (method.method (all modifier#composite + (..method_privacy privacy) + method.static + (if strict_floating_point? + method.strict + modifier.empty)) method_name #1 (type.method [method_tvars argumentsT returnJ exceptionsJ]) (list) - {.#Some ($_ _.composite - (method_arguments 0 argumentsT) - bodyG - (method_return returnJ))})))))) + {.#Some (all _.composite + (method_arguments 0 argumentsT) + bodyG + (method_return returnJ))})))))) (def: (abstract_method_generation method) (-> (jvm.Abstract_Method Synthesis) (Resource Method)) (let [[name privacy annotations variables arguments return exceptions] method] - (method.method ($_ modifier#composite - (..method_privacy privacy) - method.abstract) + (method.method (all modifier#composite + (..method_privacy privacy) + method.abstract) name #1 (type.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -687,9 +687,9 @@ (try#each (|>> (format.result class.writer) [name]) (class.class version.v6_0 - ($_ modifier#composite - class.public - modifier) + (all modifier#composite + class.public + modifier) (name.internal name) {.#Some signature} (..class_name super) @@ -724,24 +724,24 @@ _.return {.#Left valueT} - ($_ _.composite - (mock_value valueT) - (case (type.primitive? valueT) - {.#Left classT} - _.areturn - - {.#Right primitiveT} - (cond (# type.equivalence = type.long primitiveT) - _.lreturn + (all _.composite + (mock_value valueT) + (case (type.primitive? valueT) + {.#Left classT} + _.areturn + + {.#Right primitiveT} + (cond (# type.equivalence = type.long primitiveT) + _.lreturn - (# type.equivalence = type.float primitiveT) - _.freturn + (# type.equivalence = type.float primitiveT) + _.freturn - (# type.equivalence = type.double primitiveT) - _.dreturn + (# type.equivalence = type.double primitiveT) + _.dreturn - ... type.boolean type.byte type.short type.int type.char - _.ireturn))))) + ... type.boolean type.byte type.short type.int type.char + _.ireturn))))) (def: (mock_method super method) (-> (Type Class) (Method_Definition Code) (Resource method.Method)) @@ -749,32 +749,32 @@ {#Constructor [privacy strict_floating_point? annotations variables exceptions self arguments constructor_arguments body]} - (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty)) ..constructor_name #1 (type.method [variables (list#each product.right arguments) type.void exceptions]) (list) - {.#Some ($_ _.composite - (_.aload 0) - (|> constructor_arguments - (list#each (|>> product.left ..mock_value)) - (monad.all _.monad)) - (|> (type.method [(list) (list#each product.left constructor_arguments) type.void (list)]) - (_.invokespecial super ..constructor_name)) - _.return - )}) + {.#Some (all _.composite + (_.aload 0) + (|> constructor_arguments + (list#each (|>> product.left ..mock_value)) + (monad.all _.monad)) + (|> (type.method [(list) (list#each product.left constructor_arguments) type.void (list)]) + (_.invokespecial super ..constructor_name)) + _.return + )}) {#Overriden_Method [super name strict_floating_point? annotations variables self arguments return exceptions body]} - (method.method ($_ modifier#composite - method.public - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + method.public + (if strict_floating_point? + method.strict + modifier.empty)) name #1 (type.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -783,14 +783,14 @@ {#Virtual_Method [name privacy final? strict_floating_point? annotations variables self arguments return exceptions body]} - (method.method ($_ modifier#composite - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty) - (if final? - method.final - modifier.empty)) + (method.method (all modifier#composite + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty) + (if final? + method.final + modifier.empty)) name #1 (type.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -799,12 +799,12 @@ {#Static_Method [name privacy strict_floating_point? annotations variables arguments return exceptions body]} - (method.method ($_ modifier#composite - method.static - (..method_privacy privacy) - (if strict_floating_point? - method.strict - modifier.empty)) + (method.method (all modifier#composite + method.static + (..method_privacy privacy) + (if strict_floating_point? + method.strict + modifier.empty)) name #1 (type.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -812,9 +812,9 @@ {#Abstract_Method [name privacy annotations variables arguments return exceptions]} - (method.method ($_ modifier#composite - method.abstract - (..method_privacy privacy)) + (method.method (all modifier#composite + method.abstract + (..method_privacy privacy)) name #1 (type.method [variables (list#each product.right arguments) return exceptions]) (list) @@ -855,14 +855,14 @@ (def: jvm::class (Handler Anchor (Bytecode Any) Definition) (/.custom - [($_ <>.and - ..class_declaration - jvm.class - (<code>.tuple (<>.some jvm.class)) - ..inheritance - (<code>.tuple (<>.some ..annotation)) - (<code>.tuple (<>.some ..field)) - (<code>.tuple (<>.some ..method))) + [(all <>.and + ..class_declaration + jvm.class + (<code>.tuple (<>.some jvm.class)) + ..inheritance + (<code>.tuple (<>.some ..annotation)) + (<code>.tuple (<>.some ..field)) + (<code>.tuple (<>.some ..method))) (function (_ extension phase archive [class_declaration super @@ -904,9 +904,9 @@ bytecode (<| (# ! each (format.result class.writer)) phase.lifted (class.class version.v6_0 - ($_ modifier#composite - class.public - inheritance) + (all modifier#composite + class.public + inheritance) (name.internal name) {.#Some type_declaration} (..class_name super) @@ -920,9 +920,9 @@ (def: (method_declaration (open "/[0]")) (-> (jvm.Method_Declaration Code) (Resource Method)) (let [type (type.method [/#type_variables /#arguments /#return /#exceptions])] - (method.method ($_ modifier#composite - method.public - method.abstract) + (method.method (all modifier#composite + method.public + method.abstract) /#name #1 type (list) @@ -931,22 +931,22 @@ (def: jvm::class::interface (Handler Anchor (Bytecode Any) Definition) (/.custom - [($_ <>.and - ..class_declaration - (<code>.tuple (<>.some jvm.class)) - ... TODO: Handle annotations. - (<code>.tuple (<>.some ..annotation)) - (<>.some jvm.method_declaration)) + [(all <>.and + ..class_declaration + (<code>.tuple (<>.some jvm.class)) + ... TODO: Handle annotations. + (<code>.tuple (<>.some ..annotation)) + (<>.some jvm.method_declaration)) (function (_ extension_name phase archive [[name parameters] supers annotations method_declarations]) (directive.lifted_generation (do [! phase.monad] [bytecode (<| (# ! each (format.result class.writer)) phase.lifted (class.class version.v6_0 - ($_ modifier#composite - class.public - class.abstract - class.interface) + (all modifier#composite + class.public + class.abstract + class.interface) (name.internal name) {.#Some (signature.inheritance (list#each type.signature parameters) (type.signature $Object) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index a25d02ed7..2d07295c0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -274,10 +274,10 @@ (def: (def::type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) (..custom - [($_ <>.and <code>.local <code>.any - (<>.or (<code>.variant (<>.some <code>.text)) - (<code>.tuple (<>.some <code>.text))) - <code>.any) + [(all <>.and <code>.local <code>.any + (<>.or (<code>.variant (<>.some <code>.text)) + (<code>.tuple (<>.some <code>.text))) + <code>.any) (function (_ extension_name phase archive [short_name valueC labels exported?C]) (do phase.monad [current_module (/////directive.lifted_analysis @@ -366,7 +366,7 @@ (def: def::alias Handler (..custom - [($_ <>.and <code>.local <code>.symbol) + [(all <>.and <code>.local <code>.symbol) (function (_ extension_name phase archive [alias def_name]) (do phase.monad [_ (///.lifted diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index 9e68d5992..1c4b6e9d3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -56,10 +56,10 @@ ... ... TODO: Get rid of this ASAP ... (def: lux::syntax_char_case! -... (..custom [($_ <>.and +... (..custom [(all <>.and ... <s>.any ... <s>.any -... (<>.some (<s>.tuple ($_ <>.and +... (<>.some (<s>.tuple (all <>.and ... (<s>.tuple (<>.many <s>.i64)) ... <s>.any)))) ... (function (_ extension_name phase archive [input else conditionals]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index 3d2fd35f3..a85bc1fb6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -94,9 +94,9 @@ ... [[IO]] (def: (io//log messageG) (Unary Expression) - ($_ _., - (//runtime.io//log messageG) - //runtime.unit)) + (all _., + (//runtime.io//log messageG) + //runtime.unit)) (def: .public (statement expression archive synthesis) Phase! @@ -149,12 +149,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + (..custom [(all <>.and + <s>.any + <s>.any + (<>.some (<s>.tuple (all <>.and + (<s>.tuple (<>.many <s>.i64)) + <s>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do [! /////.monad] [inputG (phase archive input) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index 5037742a3..783dde8e3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -64,7 +64,7 @@ (def: object::new (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [constructorS inputsS]) (do [! ////////phase.monad] [constructorG (phase archive constructorS) @@ -74,7 +74,7 @@ (def: object::get Handler (custom - [($_ <>.and <s>.text <s>.any) + [(all <>.and <s>.text <s>.any) (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] @@ -83,7 +83,7 @@ (def: object::do Handler (custom - [($_ <>.and <s>.text <s>.any (<>.some <s>.any)) + [(all <>.and <s>.text <s>.any (<>.some <s>.any)) (function (_ extension phase archive [methodS objectS inputsS]) (do [! ////////phase.monad] [objectG (phase archive objectS) @@ -119,7 +119,7 @@ (def: js::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -128,7 +128,7 @@ (def: js::function (custom - [($_ <>.and <s>.i64 <s>.any) + [(all <>.and <s>.i64 <s>.any) (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -139,12 +139,12 @@ (list.repeated (.nat arity) [])) g!abstraction (variable "abstraction")] (in (_.closure g!inputs - ($_ _.then - (_.define g!abstraction abstractionG) - (_.return (case (.nat arity) - 0 (_.apply_1 g!abstraction //runtime.unit) - 1 (_.apply_* g!abstraction g!inputs) - _ (_.apply_1 g!abstraction (_.array g!inputs)))))))))])) + (all _.then + (_.define g!abstraction abstractionG) + (_.return (case (.nat arity) + 0 (_.apply_1 g!abstraction //runtime.unit) + 1 (_.apply_* g!abstraction g!inputs) + _ (_.apply_1 g!abstraction (_.array g!inputs)))))))))])) (def: .public bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux index 87684f26d..4b27edabb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux @@ -14,7 +14,7 @@ (def: .public bundle Bundle - ($_ dictionary.composite - /common.bundle - /host.bundle - )) + (all dictionary.composite + /common.bundle + /host.bundle + )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index eb7cb76d4..7ecc092e8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -68,15 +68,15 @@ (def: lux_int (Bytecode Any) - ($_ _.composite - _.i2l - (///value.wrap type.long))) + (all _.composite + _.i2l + (///value.wrap type.long))) (def: jvm_int (Bytecode Any) - ($_ _.composite - (///value.unwrap type.long) - _.l2i)) + (all _.composite + (///value.unwrap type.long) + _.l2i)) (def: (predicate bytecode) (-> (-> Label (Bytecode Any)) @@ -84,23 +84,23 @@ (do _.monad [@then _.new_label @end _.new_label] - ($_ _.composite - (bytecode @then) - (_.getstatic $Boolean "FALSE" $Boolean) - (_.goto @end) - (_.set_label @then) - (_.getstatic $Boolean "TRUE" $Boolean) - (_.set_label @end) - ))) + (all _.composite + (bytecode @then) + (_.getstatic $Boolean "FALSE" $Boolean) + (_.goto @end) + (_.set_label @then) + (_.getstatic $Boolean "TRUE" $Boolean) + (_.set_label @end) + ))) ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <synthesis>.any - <synthesis>.any - (<>.some (<synthesis>.tuple ($_ <>.and - (<synthesis>.tuple (<>.many <synthesis>.i64)) - <synthesis>.any)))) + (..custom [(all <>.and + <synthesis>.any + <synthesis>.any + (<>.some (<synthesis>.tuple (all <>.and + (<synthesis>.tuple (<>.many <synthesis>.i64)) + <synthesis>.any)))) (function (_ extension_name phase archive [inputS elseS conditionalsS]) (do [! /////.monad] [@end ///runtime.forge_label @@ -115,10 +115,10 @@ (in [(list#each (function (_ char) [(try.trusted (signed.s4 (.int char))) @branch]) chars) - ($_ _.composite - (_.set_label @branch) - branchG - (_.when_continuous (_.goto @end)))]))) + (all _.composite + (_.set_label @branch) + branchG + (_.when_continuous (_.goto @end)))]))) conditionalsS)) .let [table (|> conditionalsG+ (list#each product.left) @@ -128,29 +128,29 @@ (monad.all _.monad))]] (in (do _.monad [@else _.new_label] - ($_ _.composite - inputG (///value.unwrap type.long) _.l2i - (_.lookupswitch @else table) - conditionalsG - (_.set_label @else) - elseG - (<| (_.when_acknowledged @end) - (_.set_label @end)) - )))))])) + (all _.composite + inputG (///value.unwrap type.long) _.l2i + (_.lookupswitch @else table) + conditionalsG + (_.set_label @else) + elseG + (<| (_.when_acknowledged @end) + (_.set_label @end)) + )))))])) (def: (lux::is [referenceG sampleG]) (Binary (Bytecode Any)) - ($_ _.composite - referenceG - sampleG - (..predicate _.if_acmpeq))) + (all _.composite + referenceG + sampleG + (..predicate _.if_acmpeq))) (def: (lux::try riskyG) (Unary (Bytecode Any)) - ($_ _.composite - riskyG - (_.checkcast ///function.class) - ///runtime.try)) + (all _.composite + riskyG + (_.checkcast ///function.class) + ///runtime.try)) (def: bundle::lux Bundle @@ -162,10 +162,10 @@ (template [<name> <op>] [(def: (<name> [maskG inputG]) (Binary (Bytecode Any)) - ($_ _.composite - inputG (///value.unwrap type.long) - maskG (///value.unwrap type.long) - <op> (///value.wrap type.long)))] + (all _.composite + inputG (///value.unwrap type.long) + maskG (///value.unwrap type.long) + <op> (///value.wrap type.long)))] [i64::and _.land] [i64::or _.lor] @@ -175,10 +175,10 @@ (template [<name> <op>] [(def: (<name> [shiftG inputG]) (Binary (Bytecode Any)) - ($_ _.composite - inputG (///value.unwrap type.long) - shiftG ..jvm_int - <op> (///value.wrap type.long)))] + (all _.composite + inputG (///value.unwrap type.long) + shiftG ..jvm_int + <op> (///value.wrap type.long)))] [i64::left_shifted _.lshl] [i64::right_shifted _.lushr] @@ -187,10 +187,10 @@ (template [<name> <type> <op>] [(def: (<name> [paramG subjectG]) (Binary (Bytecode Any)) - ($_ _.composite - subjectG (///value.unwrap <type>) - paramG (///value.unwrap <type>) - <op> (///value.wrap <type>)))] + (all _.composite + subjectG (///value.unwrap <type>) + paramG (///value.unwrap <type>) + <op> (///value.wrap <type>)))] [i64::+ type.long _.ladd] [i64::- type.long _.lsub] @@ -209,12 +209,12 @@ [(template [<name> <reference>] [(def: (<name> [paramG subjectG]) (Binary (Bytecode Any)) - ($_ _.composite - subjectG (///value.unwrap <type>) - paramG (///value.unwrap <type>) - <cmp> - <reference> - (..predicate _.if_icmpeq)))] + (all _.composite + subjectG (///value.unwrap <type>) + paramG (///value.unwrap <type>) + <cmp> + <reference> + (..predicate _.if_icmpeq)))] [<eq> _.iconst_0] [<lt> _.iconst_m1])] @@ -230,29 +230,29 @@ (template [<name> <prepare> <transform>] [(def: (<name> inputG) (Unary (Bytecode Any)) - ($_ _.composite - inputG - <prepare> - <transform>))] + (all _.composite + inputG + <prepare> + <transform>))] [i64::f64 (///value.unwrap type.long) - ($_ _.composite - _.l2d - (///value.wrap type.double))] + (all _.composite + _.l2d + (///value.wrap type.double))] [i64::char (///value.unwrap type.long) - ($_ _.composite - _.l2i - _.i2c - (..::toString ..$Character type.char))] + (all _.composite + _.l2i + _.i2c + (..::toString ..$Character type.char))] [f64::i64 (///value.unwrap type.double) - ($_ _.composite - _.d2l - (///value.wrap type.long))] + (all _.composite + _.d2l + (///value.wrap type.long))] [f64::encode (///value.unwrap type.double) @@ -299,21 +299,21 @@ (def: (text::size inputG) (Unary (Bytecode Any)) - ($_ _.composite - inputG - (_.checkcast $String) - (_.invokevirtual ..$String "length" (type.method [(list) (list) type.int (list)])) - ..lux_int)) + (all _.composite + inputG + (_.checkcast $String) + (_.invokevirtual ..$String "length" (type.method [(list) (list) type.int (list)])) + ..lux_int)) (def: no_op (Bytecode Any) (_#in [])) (template [<name> <pre_subject> <pre_param> <op> <post>] [(def: (<name> [paramG subjectG]) (Binary (Bytecode Any)) - ($_ _.composite - subjectG <pre_subject> - paramG <pre_param> - <op> <post>))] + (all _.composite + subjectG <pre_subject> + paramG <pre_param> + <op> <post>))] [text::= ..no_op ..no_op (_.invokevirtual ..$Object "equals" (type.method [(list) (list ..$Object) type.boolean (list)])) @@ -328,20 +328,20 @@ (def: (text::concat [leftG rightG]) (Binary (Bytecode Any)) - ($_ _.composite - leftG (_.checkcast $String) - rightG (_.checkcast $String) - (_.invokevirtual ..$String "concat" (type.method [(list) (list ..$String) ..$String (list)])))) + (all _.composite + leftG (_.checkcast $String) + rightG (_.checkcast $String) + (_.invokevirtual ..$String "concat" (type.method [(list) (list ..$String) ..$String (list)])))) (def: (text::clip [offset! length! subject!]) (Trinary (Bytecode Any)) - ($_ _.composite - subject! (_.checkcast $String) - offset! ..jvm_int - _.dup - length! ..jvm_int - _.iadd - (_.invokevirtual ..$String "substring" (type.method [(list) (list type.int type.int) ..$String (list)])))) + (all _.composite + subject! (_.checkcast $String) + offset! ..jvm_int + _.dup + length! ..jvm_int + _.iadd + (_.invokevirtual ..$String "substring" (type.method [(list) (list type.int type.int) ..$String (list)])))) (def: index_method (type.method [(list) (list ..$String type.int) type.int (list)])) (def: (text::index [startG partG textG]) @@ -349,21 +349,21 @@ (do _.monad [@not_found _.new_label @end _.new_label] - ($_ _.composite - textG (_.checkcast $String) - partG (_.checkcast $String) - startG ..jvm_int - (_.invokevirtual ..$String "indexOf" index_method) - _.dup - _.iconst_m1 - (_.if_icmpeq @not_found) - ..lux_int - ///runtime.some_injection - (_.goto @end) - (_.set_label @not_found) - _.pop - ///runtime.none_injection - (_.set_label @end)))) + (all _.composite + textG (_.checkcast $String) + partG (_.checkcast $String) + startG ..jvm_int + (_.invokevirtual ..$String "indexOf" index_method) + _.dup + _.iconst_m1 + (_.if_icmpeq @not_found) + ..lux_int + ///runtime.some_injection + (_.goto @end) + (_.set_label @not_found) + _.pop + ///runtime.none_injection + (_.set_label @end)))) (def: bundle::text Bundle @@ -380,22 +380,22 @@ (def: string_method (type.method [(list) (list ..$String) type.void (list)])) (def: (io::log messageG) (Unary (Bytecode Any)) - ($_ _.composite - (_.getstatic ..$System "out" ..$PrintStream) - messageG - (_.checkcast $String) - (_.invokevirtual ..$PrintStream "println" ..string_method) - ///runtime.unit)) + (all _.composite + (_.getstatic ..$System "out" ..$PrintStream) + messageG + (_.checkcast $String) + (_.invokevirtual ..$PrintStream "println" ..string_method) + ///runtime.unit)) (def: (io::error messageG) (Unary (Bytecode Any)) - ($_ _.composite - (_.new ..$Error) - _.dup - messageG - (_.checkcast $String) - (_.invokespecial ..$Error "<init>" ..string_method) - _.athrow)) + (all _.composite + (_.new ..$Error) + _.dup + messageG + (_.checkcast $String) + (_.invokespecial ..$Error "<init>" ..string_method) + _.athrow)) (def: bundle::io Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index f5fbdaf17..908057f4d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -82,9 +82,9 @@ (template [<name> <0>] [(def: <name> (Bytecode Any) - ($_ _.composite - _.l2i - <0>))] + (all _.composite + _.l2i + <0>))] [l2s _.i2s] [l2b _.i2b] @@ -96,9 +96,9 @@ (Unary (Bytecode Any)) (if (same? _.nop <conversion>) inputG - ($_ _.composite - inputG - <conversion>)))] + (all _.composite + inputG + <conversion>)))] [_.d2f conversion::double_to_float] [_.d2i conversion::double_to_int] @@ -171,10 +171,10 @@ (template [<name> <op>] [(def: (<name> [parameter! subject!]) (Binary (Bytecode Any)) - ($_ _.composite - subject! - parameter! - <op>))] + (all _.composite + subject! + parameter! + <op>))] [int::+ _.iadd] [int::- _.isub] @@ -223,15 +223,15 @@ (do _.monad [@then _.new_label @end _.new_label] - ($_ _.composite - subject - reference - (<op> @then) - falseG - (_.goto @end) - (_.set_label @then) - trueG - (_.set_label @end))))] + (all _.composite + subject + reference + (<op> @then) + falseG + (_.goto @end) + (_.set_label @then) + trueG + (_.set_label @end))))] [int::= _.if_icmpeq] [int::< _.if_icmplt] @@ -246,17 +246,17 @@ (do _.monad [@then _.new_label @end _.new_label] - ($_ _.composite - subject - reference - <op> - (_.int (i32.i32 (.i64 <reference>))) - (_.if_icmpeq @then) - falseG - (_.goto @end) - (_.set_label @then) - trueG - (_.set_label @end))))] + (all _.composite + subject + reference + <op> + (_.int (i32.i32 (.i64 <reference>))) + (_.if_icmpeq @then) + falseG + (_.goto @end) + (_.set_label @then) + trueG + (_.set_label @end))))] [long::= _.lcmp +0] [long::< _.lcmp -1] @@ -389,22 +389,22 @@ (function (_ extension_name generate archive arrayS) (do //////.monad [arrayG (generate archive arrayS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array jvm_primitive)) - _.arraylength))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array jvm_primitive)) + _.arraylength))))])) (def: array::length::object Handler (..custom - [($_ <>.and ..object_array <synthesis>.any) + [(all <>.and ..object_array <synthesis>.any) (function (_ extension_name generate archive [elementJT arrayS]) (do //////.monad [arrayG (generate archive arrayS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array elementJT)) - _.arraylength))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array elementJT)) + _.arraylength))))])) (def: (new_primitive_array_handler jvm_primitive) (-> Primitive_Array_Type Handler) @@ -413,82 +413,82 @@ (function (_ extension_name generate archive [lengthS]) (do //////.monad [lengthG (generate archive lengthS)] - (in ($_ _.composite - lengthG - (_.newarray jvm_primitive)))))])) + (in (all _.composite + lengthG + (_.newarray jvm_primitive)))))])) (def: array::new::object Handler (..custom - [($_ <>.and ..object <synthesis>.any) + [(all <>.and ..object <synthesis>.any) (function (_ extension_name generate archive [objectJT lengthS]) (do //////.monad [lengthG (generate archive lengthS)] - (in ($_ _.composite - lengthG - (_.anewarray objectJT)))))])) + (in (all _.composite + lengthG + (_.anewarray objectJT)))))])) (def: (read_primitive_array_handler jvm_primitive loadG) (-> (Type Primitive) (Bytecode Any) Handler) (..custom - [($_ <>.and <synthesis>.any <synthesis>.any) + [(all <>.and <synthesis>.any <synthesis>.any) (function (_ extension_name generate archive [idxS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array jvm_primitive)) - idxG - loadG))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array jvm_primitive)) + idxG + loadG))))])) (def: array::read::object Handler (..custom - [($_ <>.and ..object_array <synthesis>.any <synthesis>.any) + [(all <>.and ..object_array <synthesis>.any <synthesis>.any) (function (_ extension_name generate archive [elementJT idxS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array elementJT)) - idxG - _.aaload))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array elementJT)) + idxG + _.aaload))))])) (def: (write_primitive_array_handler jvm_primitive storeG) (-> (Type Primitive) (Bytecode Any) Handler) (..custom - [($_ <>.and <synthesis>.any <synthesis>.any <synthesis>.any) + [(all <>.and <synthesis>.any <synthesis>.any <synthesis>.any) (function (_ extension_name generate archive [idxS valueS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS) valueG (generate archive valueS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array jvm_primitive)) - _.dup - idxG - valueG - storeG))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array jvm_primitive)) + _.dup + idxG + valueG + storeG))))])) (def: array::write::object Handler (..custom - [($_ <>.and ..object_array <synthesis>.any <synthesis>.any <synthesis>.any) + [(all <>.and ..object_array <synthesis>.any <synthesis>.any <synthesis>.any) (function (_ extension_name generate archive [elementJT idxS valueS arrayS]) (do //////.monad [arrayG (generate archive arrayS) idxG (generate archive idxS) valueG (generate archive valueS)] - (in ($_ _.composite - arrayG - (_.checkcast (type.array elementJT)) - _.dup - idxG - valueG - _.aastore))))])) + (in (all _.composite + arrayG + (_.checkcast (type.array elementJT)) + _.dup + idxG + valueG + _.aastore))))])) (def: bundle::array Bundle @@ -549,30 +549,30 @@ (do _.monad [@then _.new_label @end _.new_label] - ($_ _.composite - objectG - (_.ifnull @then) - ..falseG - (_.goto @end) - (_.set_label @then) - ..trueG - (_.set_label @end)))) + (all _.composite + objectG + (_.ifnull @then) + ..falseG + (_.goto @end) + (_.set_label @then) + ..trueG + (_.set_label @end)))) (def: (object::synchronized [monitorG exprG]) (Binary (Bytecode Any)) - ($_ _.composite - monitorG - _.dup - _.monitorenter - exprG - _.swap - _.monitorexit)) + (all _.composite + monitorG + _.dup + _.monitorenter + exprG + _.swap + _.monitorexit)) (def: (object::throw exceptionG) (Unary (Bytecode Any)) - ($_ _.composite - exceptionG - _.athrow)) + (all _.composite + exceptionG + _.athrow)) (def: $Class (type.class "java.lang.Class" (list))) (def: $String (type.class "java.lang.String" (list))) @@ -584,41 +584,41 @@ (function (_ extension_name generate archive [class]) (do //////.monad [] - (in ($_ _.composite - (_.string class) - (_.invokestatic ..$Class "forName" (type.method [(list) (list ..$String) ..$Class (list)]))))))])) + (in (all _.composite + (_.string class) + (_.invokestatic ..$Class "forName" (type.method [(list) (list ..$String) ..$Class (list)]))))))])) (def: object::instance? Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.any) + [(all <>.and <synthesis>.text <synthesis>.any) (function (_ extension_name generate archive [class objectS]) (do //////.monad [objectG (generate archive objectS)] - (in ($_ _.composite - objectG - (_.instanceof (type.class class (list))) - (///value.wrap type.boolean)))))])) + (in (all _.composite + objectG + (_.instanceof (type.class class (list))) + (///value.wrap type.boolean)))))])) (def: object::cast Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.text <synthesis>.any) + [(all <>.and <synthesis>.text <synthesis>.text <synthesis>.any) (function (_ extension_name generate archive [from to valueS]) (do //////.monad [valueG (generate archive valueS)] (in (`` (cond (~~ (template [<object> <type>] [(and (text#= (..reflection <type>) from) (text#= <object> to)) - ($_ _.composite - valueG - (///value.wrap <type>)) + (all _.composite + valueG + (///value.wrap <type>)) (and (text#= <object> from) (text#= (..reflection <type>) to)) - ($_ _.composite - valueG - (///value.unwrap <type>))] + (all _.composite + valueG + (///value.unwrap <type>))] [box.boolean type.boolean] [box.byte type.byte] @@ -647,7 +647,7 @@ (def: get::static Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.text ..value) + [(all <>.and <synthesis>.text <synthesis>.text ..value) (function (_ extension_name generate archive [class field :unboxed:]) (# //////.monad in (_.getstatic (type.class class (list)) field :unboxed:)))])) @@ -657,39 +657,39 @@ (def: put::static Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any) + [(all <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any) (function (_ extension_name generate archive [class field :unboxed: valueS]) (do //////.monad [valueG (generate archive valueS)] - (in ($_ _.composite - valueG - (case (parser.object? :unboxed:) - {.#Some :unboxed:} - (_.checkcast :unboxed:) - - {.#None} - (_#in [])) - (_.putstatic (type.class class (list)) field :unboxed:) - ..unitG))))])) + (in (all _.composite + valueG + (case (parser.object? :unboxed:) + {.#Some :unboxed:} + (_.checkcast :unboxed:) + + {.#None} + (_#in [])) + (_.putstatic (type.class class (list)) field :unboxed:) + ..unitG))))])) (def: get::virtual Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any) + [(all <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any) (function (_ extension_name generate archive [class field :unboxed: objectS]) (do //////.monad [objectG (generate archive objectS) .let [:class: (type.class class (list)) getG (_.getfield :class: field :unboxed:)]] - (in ($_ _.composite - objectG - (_.checkcast :class:) - getG))))])) + (in (all _.composite + objectG + (_.checkcast :class:) + getG))))])) (def: put::virtual Handler (..custom - [($_ <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any <synthesis>.any) + [(all <>.and <synthesis>.text <synthesis>.text ..value <synthesis>.any <synthesis>.any) (function (_ extension_name generate archive [class field :unboxed: valueS objectS]) (do //////.monad [valueG (generate archive valueS) @@ -697,18 +697,18 @@ .let [:class: (type.class class (list)) putG (case (parser.object? :unboxed:) {.#Some :unboxed:} - ($_ _.composite - (_.checkcast :unboxed:) - (_.putfield :class: field :unboxed:)) + (all _.composite + (_.checkcast :unboxed:) + (_.putfield :class: field :unboxed:)) {.#None} (_.putfield :class: field :unboxed:))]] - (in ($_ _.composite - objectG - (_.checkcast :class:) - _.dup - valueG - putG))))])) + (in (all _.composite + objectG + (_.checkcast :class:) + _.dup + valueG + putG))))])) (type: Input (Typed Synthesis)) @@ -726,9 +726,9 @@ (in [valueT valueG]) {.#Left valueT} - (in [valueT ($_ _.composite - valueG - (_.checkcast valueT))])))) + (in [valueT (all _.composite + valueG + (_.checkcast valueT))])))) (def: (prepare_output outputT) (-> (Type Return) (Bytecode Any)) @@ -742,32 +742,32 @@ (def: invoke::static Handler (..custom - [($_ <>.and ..class <synthesis>.text ..return (<>.some ..input)) + [(all <>.and ..class <synthesis>.text ..return (<>.some ..input)) (function (_ extension_name generate archive [class method outputT inputsTS]) (do [! //////.monad] [inputsTG (monad.each ! (generate_input generate archive) inputsTS)] - (in ($_ _.composite - (monad.each _.monad product.right inputsTG) - (_.invokestatic class method (type.method [(list) (list#each product.left inputsTG) outputT (list)])) - (prepare_output outputT)))))])) + (in (all _.composite + (monad.each _.monad product.right inputsTG) + (_.invokestatic class method (type.method [(list) (list#each product.left inputsTG) outputT (list)])) + (prepare_output outputT)))))])) (template [<check_cast?> <name> <invoke>] [(def: <name> Handler (..custom - [($_ <>.and ..class <synthesis>.text ..return <synthesis>.any (<>.some ..input)) + [(all <>.and ..class <synthesis>.text ..return <synthesis>.any (<>.some ..input)) (function (_ extension_name generate archive [class method outputT objectS inputsTS]) (do [! //////.monad] [objectG (generate archive objectS) inputsTG (monad.each ! (generate_input generate archive) inputsTS)] - (in ($_ _.composite - objectG - (if <check_cast?> - (_.checkcast class) - (_#in [])) - (monad.each _.monad product.right inputsTG) - (<invoke> class method (type.method [(list) (list#each product.left inputsTG) outputT (list)])) - (prepare_output outputT)))))]))] + (in (all _.composite + objectG + (if <check_cast?> + (_.checkcast class) + (_#in [])) + (monad.each _.monad product.right inputsTG) + (<invoke> class method (type.method [(list) (list#each product.left inputsTG) outputT (list)])) + (prepare_output outputT)))))]))] [#1 invoke::virtual _.invokevirtual] [#0 invoke::special _.invokespecial] @@ -777,15 +777,15 @@ (def: invoke::constructor Handler (..custom - [($_ <>.and ..class (<>.some ..input)) + [(all <>.and ..class (<>.some ..input)) (function (_ extension_name generate archive [class inputsTS]) (do [! //////.monad] [inputsTG (monad.each ! (generate_input generate archive) inputsTS)] - (in ($_ _.composite - (_.new class) - _.dup - (monad.each _.monad product.right inputsTG) - (_.invokespecial class "<init>" (type.method [(list) (list#each product.left inputsTG) type.void (list)]))))))])) + (in (all _.composite + (_.new class) + _.dup + (monad.each _.monad product.right inputsTG) + (_.invokespecial class "<init>" (type.method [(list) (list#each product.left inputsTG) type.void (list)]))))))])) (def: bundle::member Bundle @@ -993,42 +993,42 @@ {.#Left type} (_.checkcast type))] - ($_ _.composite - (_.aload (++ register)) - then!)))) + (all _.composite + (_.aload (++ register)) + then!)))) list.reversed (list#mix _.composite (_#in []))) store_captured! (|> env list.size list.indices (monad.each _.monad (.function (_ register) - ($_ _.composite - (_.aload 0) - (_.aload (n.+ inputs_offset (++ register))) - (_.putfield class (///reference.foreign_name register) $Object)))))] + (all _.composite + (_.aload 0) + (_.aload (n.+ inputs_offset (++ register))) + (_.putfield class (///reference.foreign_name register) $Object)))))] (method.method method.public "<init>" #1 (anonymous_init_method env inputsTG) (list) - {.#Some ($_ _.composite - (_.aload 0) - inputs! - (_.invokespecial super_class "<init>" (type.method [(list) (list#each product.left inputsTG) type.void (list)])) - store_captured! - _.return)}))) + {.#Some (all _.composite + (_.aload 0) + inputs! + (_.invokespecial super_class "<init>" (type.method [(list) (list#each product.left inputsTG) type.void (list)])) + store_captured! + _.return)}))) (def: (anonymous_instance generate archive class env inputsTI) (-> Phase Archive (Type category.Class) (Environment Synthesis) (List (Typed (Bytecode Any))) (Operation (Bytecode Any))) (do [! //////.monad] [captureG+ (monad.each ! (generate archive) env)] - (in ($_ _.composite - (_.new class) - _.dup - (|> inputsTI - (list#each product.right) - list.reversed - (list#mix _.composite (_#in []))) - (monad.all _.monad captureG+) - (_.invokespecial class "<init>" (anonymous_init_method env inputsTI)))))) + (in (all _.composite + (_.new class) + _.dup + (|> inputsTI + (list#each product.right) + list.reversed + (list#mix _.composite (_#in []))) + (monad.all _.monad captureG+) + (_.invokespecial class "<init>" (anonymous_init_method env inputsTI)))))) (def: (returnG returnT) (-> (Type Return) (Bytecode Any)) @@ -1041,18 +1041,18 @@ {.#Left returnT} (case (type.class? returnT) {.#Some class_name} - ($_ _.composite - (_.checkcast returnT) - _.areturn) + (all _.composite + (_.checkcast returnT) + _.areturn) {.#None} _.areturn) {.#Right returnT} (template.let [(unwrap_primitive <return> <type>) - [($_ _.composite - (///value.unwrap <type>) - <return>)]] + [(all _.composite + (///value.unwrap <type>) + <return>)]] (`` (cond (~~ (template [<return> <type>] [(# type.equivalence = <type> returnT) (unwrap_primitive <return> <type>)] @@ -1085,10 +1085,10 @@ list.together (monad.each ! (cache/artifact.dependencies archive))) all_method_dependencies (monad.each ! (|>> product.right (method_dependencies archive)) overriden_methods)] - (in (cache/artifact.all ($_ list#composite - all_input_dependencies - all_closure_dependencies - all_method_dependencies))))) + (in (cache/artifact.all (all list#composite + all_input_dependencies + all_closure_dependencies + all_method_dependencies))))) (def: (prepare_argument lux_register argumentT jvm_register) (-> Register (Type Value) Register [Register (Bytecode Any)]) @@ -1097,17 +1097,17 @@ [(n.+ 1 jvm_register) (if (n.= lux_register jvm_register) (_#in []) - ($_ _.composite - (_.aload jvm_register) - (_.astore lux_register)))] + (all _.composite + (_.aload jvm_register) + (_.astore lux_register)))] {.#Right argumentT} (template.let [(wrap_primitive <shift> <load> <type>) [[(n.+ <shift> jvm_register) - ($_ _.composite - (<load> jvm_register) - (///value.wrap <type>) - (_.astore lux_register))]]] + (all _.composite + (<load> jvm_register) + (///value.wrap <type>) + (_.astore lux_register))]]] (`` (cond (~~ (template [<shift> <load> <type>] [(# type.equivalence = <type> argumentT) (wrap_primitive <shift> <load> <type>)] @@ -1130,9 +1130,9 @@ (list#mix (function (_ [lux_register type] [jvm_register before]) (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)] [jvm_register' - ($_ _.composite - before - after)])) + (all _.composite + before + after)])) (is [Register (Bytecode Any)] [offset (_#in [])])) @@ -1184,28 +1184,28 @@ (phase archive bodyS)) .let [argumentsT (list#each product.right arguments) methodT (type.method [vars argumentsT returnT exceptionsT])]] - (in (method.method ($_ modifier#composite - method.public - method.final - (if strict_fp? - method.strict - modifier#identity)) + (in (method.method (all modifier#composite + method.public + method.final + (if strict_fp? + method.strict + modifier#identity)) name #1 methodT (list) - {.#Some ($_ _.composite - (prepare_arguments 1 argumentsT) - bodyG - (returnG returnT))}))))) + {.#Some (all _.composite + (prepare_arguments 1 argumentsT) + bodyG + (returnG returnT))}))))) (def: class::anonymous Handler (..custom - [($_ <>.and - ..class - (<synthesis>.tuple (<>.some ..class)) - (<synthesis>.tuple (<>.some ..input)) - (<synthesis>.tuple (<>.some ..overriden_method_definition))) + [(all <>.and + ..class + (<synthesis>.tuple (<>.some ..class)) + (<synthesis>.tuple (<>.some ..input)) + (<synthesis>.tuple (<>.some ..overriden_method_definition))) (function (_ extension_name generate archive [super_class super_interfaces inputsTS @@ -1224,7 +1224,7 @@ (monad.each ! (method_definition generate archive artifact_id))) bytecode (<| (# ! each (format.result class.writer)) //////.lifted - (class.class version.v6_0 ($_ modifier#composite class.public class.final) + (class.class version.v6_0 (all modifier#composite class.public class.final) (name.internal anonymous_class_name) {.#None} (name.internal (..reflection super_class)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index ea9f1b1c9..cb29b9c89 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -112,12 +112,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + (..custom [(all <>.and + <s>.any + <s>.any + (<>.some (<s>.tuple (all <>.and + (<s>.tuple (<>.many <s>.i64)) + <s>.any)))) (function (_ extension_name phase archive [input else conditionals]) (|> conditionals (list#each (function (_ [chars branch]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux index d854e210d..1d3f9cae4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux @@ -67,7 +67,7 @@ (def: object::get Handler (custom - [($_ <>.and <s>.text <s>.any) + [(all <>.and <s>.text <s>.any) (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] @@ -76,7 +76,7 @@ (def: object::do Handler (custom - [($_ <>.and <s>.text <s>.any (<>.some <s>.any)) + [(all <>.and <s>.text <s>.any (<>.some <s>.any)) (function (_ extension phase archive [methodS objectS inputsS]) (do [! ////////phase.monad] [objectG (phase archive objectS) @@ -141,7 +141,7 @@ (def: lua::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -150,7 +150,7 @@ (def: lua::power (custom - [($_ <>.and <s>.any <s>.any) + [(all <>.and <s>.any <s>.any) (function (_ extension phase archive [powerS baseS]) (do [! ////////phase.monad] [powerG (phase archive powerS) @@ -166,7 +166,7 @@ (def: lua::function (custom - [($_ <>.and <s>.i64 <s>.any) + [(all <>.and <s>.i64 <s>.any) (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index 1caff3899..e592ebd5c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -56,12 +56,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + (..custom [(all <>.and + <s>.any + <s>.any + (<>.some (<s>.tuple (all <>.and + (<s>.tuple (<>.many <s>.i64)) + <s>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do [! /////.monad] [inputG (phase archive input) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux index 4f4f010da..2e257bcfc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux @@ -62,7 +62,7 @@ (def: object::new (custom - [($_ <>.and <s>.text (<>.some <s>.any)) + [(all <>.and <s>.text (<>.some <s>.any)) (function (_ extension phase archive [constructor inputsS]) (do [! ////////phase.monad] [inputsG (monad.each ! (phase archive) inputsS)] @@ -71,7 +71,7 @@ (def: object::get Handler (custom - [($_ <>.and <s>.text <s>.any) + [(all <>.and <s>.text <s>.any) (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] @@ -80,7 +80,7 @@ (def: object::do Handler (custom - [($_ <>.and <s>.text <s>.any (<>.some <s>.any)) + [(all <>.and <s>.text <s>.any (<>.some <s>.any)) (function (_ extension phase archive [methodS objectS inputsS]) (do [! ////////phase.monad] [objectG (phase archive objectS) @@ -113,7 +113,7 @@ (def: php::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -122,7 +122,7 @@ (def: php::pack (custom - [($_ <>.and <s>.any <s>.any) + [(all <>.and <s>.any <s>.any) (function (_ extension phase archive [formatS dataS]) (do [! ////////phase.monad] [formatG (phase archive formatS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index 12260ae49..9de656cd2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -103,12 +103,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <synthesis>.any - <synthesis>.any - (<>.some (<synthesis>.tuple ($_ <>.and - (<synthesis>.tuple (<>.many <synthesis>.i64)) - <synthesis>.any)))) + (..custom [(all <>.and + <synthesis>.any + <synthesis>.any + (<>.some (<synthesis>.tuple (all <>.and + (<synthesis>.tuple (<>.many <synthesis>.i64)) + <synthesis>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do [! /////.monad] [inputG (phase archive input) @@ -137,7 +137,7 @@ ... conditionals)})) ... @closure (_.var (reference.artifact artifact_id)) ... closure (_.def @closure dependencies - ... ($_ _.then + ... (all _.then ... (_.set (list @input) inputG) ... (list#mix (function (_ [test then!] else!) ... (_.if test then! else!)) @@ -149,12 +149,12 @@ ... (in (_.apply/* @closure dependencies)) (in (<| (as (Expression Any)) (is (Statement Any)) - ($_ _.then - (_.set (list @input) inputG) - (list#mix (function (_ [test then!] else!) - (_.if test then! else!)) - else! - conditionals!))))))])) + (all _.then + (_.set (list @input) inputG) + (list#mix (function (_ [test then!] else!) + (_.if test then! else!)) + else! + conditionals!))))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux index 1522dc667..766979aa0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux @@ -68,7 +68,7 @@ (def: object::get Handler (custom - [($_ <>.and <s>.text <s>.any) + [(all <>.and <s>.text <s>.any) (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] @@ -77,7 +77,7 @@ (def: object::do Handler (custom - [($_ <>.and <s>.text <s>.any (<>.some <s>.any)) + [(all <>.and <s>.text <s>.any (<>.some <s>.any)) (function (_ extension phase archive [methodS objectS inputsS]) (do [! ////////phase.monad] [objectG (phase archive objectS) @@ -119,7 +119,7 @@ (def: python::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -128,7 +128,7 @@ (def: python::function (custom - [($_ <>.and <s>.i64 <s>.any) + [(all <>.and <s>.i64 <s>.any) (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) @@ -145,7 +145,7 @@ (def: python::exec (custom - [($_ <>.and <s>.any <s>.any) + [(all <>.and <s>.any <s>.any) (function (_ extension phase archive [codeS globalsS]) (do [! ////////phase.monad] [codeG (phase archive codeS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux index e48ccb29c..5b6428fa8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux @@ -56,10 +56,10 @@ ... ... ... TODO: Get rid of this ASAP ... ... (def: lux::syntax_char_case! -... ... (..custom [($_ <>.and +... ... (..custom [(all <>.and ... ... <s>.any ... ... <s>.any -... ... (<>.some (<s>.tuple ($_ <>.and +... ... (<>.some (<s>.tuple (all <>.and ... ... (<s>.tuple (<>.many <s>.i64)) ... ... <s>.any)))) ... ... (function (_ extension_name phase archive [input else conditionals]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index 0221c118b..2a838bef9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -102,12 +102,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + (..custom [(all <>.and + <s>.any + <s>.any + (<>.some (<s>.tuple (all <>.and + (<s>.tuple (<>.many <s>.i64)) + <s>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do [! /////.monad] [inputG (phase archive input) @@ -135,12 +135,12 @@ ... (in (_.apply_lambda/* (list inputG) closure)) (in (<| (as Expression) (is Statement) - ($_ _.then - (_.set (list @input) inputG) - (list#mix (function (_ [test then!] else!) - (_.if test then! else!)) - else! - conditionals!))))))])) + (all _.then + (_.set (list @input) inputG) + (list#mix (function (_ [test then!] else!) + (_.if test then! else!)) + else! + conditionals!))))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux index bb512a883..2c6013cf1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux @@ -67,7 +67,7 @@ (def: object::get Handler (custom - [($_ <>.and <s>.text <s>.any) + [(all <>.and <s>.text <s>.any) (function (_ extension phase archive [fieldS objectS]) (do ////////phase.monad [objectG (phase archive objectS)] @@ -76,7 +76,7 @@ (def: object::do Handler (custom - [($_ <>.and <s>.text <s>.any (<>.some <s>.any)) + [(all <>.and <s>.text <s>.any (<>.some <s>.any)) (function (_ extension phase archive [methodS objectS inputsS]) (do [! ////////phase.monad] [objectG (phase archive objectS) @@ -108,7 +108,7 @@ (def: ruby::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index c73614b6d..144415363 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -56,12 +56,12 @@ ... TODO: Get rid of this ASAP (def: lux::syntax_char_case! - (..custom [($_ <>.and - <s>.any - <s>.any - (<>.some (<s>.tuple ($_ <>.and - (<s>.tuple (<>.many <s>.i64)) - <s>.any)))) + (..custom [(all <>.and + <s>.any + <s>.any + (<>.some (<s>.tuple (all <>.and + (<s>.tuple (<>.many <s>.i64)) + <s>.any)))) (function (_ extension_name phase archive [input else conditionals]) (do [! /////.monad] [@input (# ! each _.var (generation.symbol "input")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux index 2b4e5cd45..6b53f712f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux @@ -89,7 +89,7 @@ (def: scheme::apply (custom - [($_ <>.and <s>.any (<>.some <s>.any)) + [(all <>.and <s>.any (<>.some <s>.any)) (function (_ extension phase archive [abstractionS inputsS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux index 43ca63829..2f5b895e3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux @@ -131,12 +131,12 @@ (def: (alternation @otherwise pre! post!) (-> _.Tag (Expression Any) (Expression Any) (Expression Any)) - (_.tagbody ($_ list#composite - (list ..save! - pre! - @otherwise) - ..restore! - (list post!)))) + (_.tagbody (all list#composite + (list ..save! + pre! + @otherwise) + ..restore! + (list post!)))) (def: (pattern_matching' expression archive) (Generator [Var/1 _.Tag _.Tag Path]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux index fe6ef4179..527ee9822 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux @@ -114,9 +114,9 @@ (def: (void code) (-> (Expression Any) (Expression Any)) - ($_ _.progn - code - ///runtime.unit)) + (all _.progn + code + ///runtime.unit)) (def: io_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 4fc1e5427..947dd7cc7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -165,9 +165,9 @@ (def: last_index (|>> _.length/1 [(_.int +1)] _.-/2)) -(with_expansions [<recur> (these ($_ _.then - (_.; (_.set lefts (_.-/2 [last_index_right lefts]))) - (_.; (_.set tuple (_.nth last_index_right tuple)))))] +(with_expansions [<recur> (these (all _.then + (_.; (_.set lefts (_.-/2 [last_index_right lefts]))) + (_.; (_.set tuple (_.nth last_index_right tuple)))))] (template: (!recur <side>) (<side> (_.-/2 [last_index_right lefts]) (_.elt/2 [tuple last_index_right]))) @@ -272,12 +272,12 @@ (list @io//exit)) (def: runtime - (_.progn ($_ list#composite - runtime//adt - runtime//lux - runtime//i64 - runtime//text - runtime//io))) + (_.progn (all list#composite + runtime//adt + runtime//lux + runtime//i64 + runtime//text + runtime//io))) (def: .public generate (Operation [Registry Output]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index 1573a17e5..515518eb7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -53,9 +53,9 @@ (do ///////phase.monad [this (expression archive this) that (statement expression archive that)] - (in ($_ _.then - (_.statement this) - that)))) + (in (all _.then + (_.statement this) + that)))) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) @@ -72,9 +72,9 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (in ($_ _.then - (_.define (..register register) valueO) - bodyO)))) + (in (all _.then + (_.define (..register register) valueO) + bodyO)))) (def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -152,15 +152,15 @@ (template [<name> <flag>] [(def: (<name> simple? idx) (-> Bit Nat Statement) - ($_ _.then - (_.set @temp (//runtime.sum//get ..peek_cursor <flag> - (|> idx .int _.i32))) - (.if simple? - (_.when (_.= _.null @temp) - ..fail_pm!) - (_.if (_.= _.null @temp) - ..fail_pm! - (push_cursor! @temp)))))] + (all _.then + (_.set @temp (//runtime.sum//get ..peek_cursor <flag> + (|> idx .int _.i32))) + (.if simple? + (_.when (_.= _.null @temp) + ..fail_pm!) + (_.if (_.= _.null @temp) + ..fail_pm! + (push_cursor! @temp)))))] [left_choice _.null] [right_choice //runtime.unit] @@ -168,14 +168,14 @@ (def: (alternation pre! post!) (-> Statement Statement Statement) - ($_ _.then - (_.do_while (_.boolean false) - ($_ _.then - ..save_cursor! - pre!)) - ($_ _.then - ..restore_cursor! - post!))) + (all _.then + (_.do_while (_.boolean false) + (all _.then + ..save_cursor! + pre!)) + (all _.then + ..restore_cursor! + post!))) (def: (optimized_pattern_matching again pathP) (-> (-> Path (Operation Statement)) @@ -198,9 +198,9 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (again thenP)] - (in {.#Some ($_ _.then - (_.define (..register register) (_.at (_.i32 +0) ..peek_cursor)) - then!)})) + (in {.#Some (all _.then + (_.define (..register register) (_.at (_.i32 +0) ..peek_cursor)) + then!)})) ... Extra optimization (^.template [<pm> <getter>] @@ -209,26 +209,26 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (again thenP)] - (in {.#Some ($_ _.then - (_.define (..register register) (<getter> (_.i32 (.int lefts)) ..peek_cursor)) - then!)}))]) + (in {.#Some (all _.then + (_.define (..register register) (<getter> (_.i32 (.int lefts)) ..peek_cursor)) + then!)}))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (pattern (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (again thenP)] - (in {.#Some ($_ _.then - (_.define (..register register) ..peek_and_pop_cursor) - then!)})) + (in {.#Some (all _.then + (_.define (..register register) ..peek_and_pop_cursor) + then!)})) (pattern (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] (do ///////phase.monad [next! (again nextP')] - (in {.#Some ($_ _.then - (multi_pop_cursor! (n.+ 2 extra_pops)) - next!)}))) + (in {.#Some (all _.then + (multi_pop_cursor! (n.+ 2 extra_pops)) + next!)}))) _ (///////phase#in {.#None}))) @@ -322,21 +322,21 @@ (-> Phase! Phase Archive Path (Operation Statement)) (do ///////phase.monad [pattern_matching! (pattern_matching' statement expression archive pathP)] - (in ($_ _.then - (_.do_while (_.boolean false) - pattern_matching!) - (_.throw (_.string ////synthesis/case.pattern_matching_error)))))) + (in (all _.then + (_.do_while (_.boolean false) + pattern_matching!) + (_.throw (_.string ////synthesis/case.pattern_matching_error)))))) (def: .public (case! statement expression archive [valueS pathP]) (Generator! [Synthesis Path]) (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (in ($_ _.then - (_.declare @temp) - (_.define @cursor (_.array (list stack_init))) - (_.define @savepoint (_.array (list))) - pattern_matching!)))) + (in (all _.then + (_.declare @temp) + (_.define @cursor (_.array (list stack_init))) + (_.define @savepoint (_.array (list))) + pattern_matching!)))) (def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index 39fdda23a..4f3b402f6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -89,42 +89,42 @@ (|> func (_.do "apply" (list _.null args)))) initialize_self! (_.define (//case.register 0) @self) initialize! (list#mix (.function (_ post pre!) - ($_ _.then - pre! - (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments)))) + (all _.then + pre! + (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments)))) initialize_self! (list.indices arity))] environment (monad.each ! (expression archive) environment) .let [[definition instantiation] (with_closure @self environment - ($_ _.then - (_.define @num_args (_.the "length" @@arguments)) - (<| (_.if (|> @num_args (_.= arityO)) - ($_ _.then - initialize! - (_.with_label (_.label @scope) - (_.do_while (_.boolean true) - body!)))) - (_.if (|> @num_args (_.> arityO)) - (let [arity_inputs (|> (_.array (list)) - (_.the "slice") - (_.do "call" (list @@arguments (_.i32 +0) arityO))) - extra_inputs (|> (_.array (list)) - (_.the "slice") - (_.do "call" (list @@arguments arityO)))] - (_.return (|> @self - (apply_poly arity_inputs) - (apply_poly extra_inputs))))) - ... (|> @num_args (_.< arityO)) - (let [all_inputs (|> (_.array (list)) - (_.the "slice") - (_.do "call" (list @@arguments)))] - ($_ _.then - (_.define @curried all_inputs) - (_.return (_.closure (list) - (let [@missing all_inputs] - (_.return (apply_poly (_.do "concat" (list @missing) @curried) - @self)))))))) - ))] + (all _.then + (_.define @num_args (_.the "length" @@arguments)) + (<| (_.if (|> @num_args (_.= arityO)) + (all _.then + initialize! + (_.with_label (_.label @scope) + (_.do_while (_.boolean true) + body!)))) + (_.if (|> @num_args (_.> arityO)) + (let [arity_inputs (|> (_.array (list)) + (_.the "slice") + (_.do "call" (list @@arguments (_.i32 +0) arityO))) + extra_inputs (|> (_.array (list)) + (_.the "slice") + (_.do "call" (list @@arguments arityO)))] + (_.return (|> @self + (apply_poly arity_inputs) + (apply_poly extra_inputs))))) + ... (|> @num_args (_.< arityO)) + (let [all_inputs (|> (_.array (list)) + (_.the "slice") + (_.do "call" (list @@arguments)))] + (all _.then + (_.define @curried all_inputs) + (_.return (_.closure (list) + (let [@missing all_inputs] + (_.return (apply_poly (_.do "concat" (list @missing) @curried) + @self)))))))) + ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) {.#None} definition)] (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index 5321ca9f8..8d92a81dd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -41,12 +41,12 @@ (pattern (list binding)) (let [$binding (//case.register offset)] - ($_ _.then - (if initial? - (_.define $binding binding) - (_.set $binding binding)) - body - )) + (all _.then + (if initial? + (_.define $binding binding) + (_.set $binding binding)) + body + )) _ (|> bindings @@ -104,12 +104,12 @@ [[offset @scope] /////generation.anchor argsO+ (monad.each ! (expression archive) argsS+) $iteration (# ! each ..$iteration /////generation.next)] - (in ($_ _.then - (_.define @temp (_.array argsO+)) - (..setup $iteration - false offset - (|> argsO+ - list.enumeration - (list#each (function (_ [idx _]) - (_.at (_.i32 (.int idx)) @temp)))) - (_.continue_at (_.label @scope))))))) + (in (all _.then + (_.define @temp (_.array argsO+)) + (..setup $iteration + false offset + (|> argsO+ + list.enumeration + (list#each (function (_ [idx _]) + (_.at (_.i32 (.int idx)) @temp)))) + (_.continue_at (_.label @scope))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 36db99857..57f34fed4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -140,33 +140,33 @@ (_.at (..last_index tuple) tuple)) -(with_expansions [<recur> (these ($_ _.then - (_.set lefts (_.- last_index_right lefts)) - (_.set tuple (_.at last_index_right tuple))))] +(with_expansions [<recur> (these (all _.then + (_.set lefts (_.- last_index_right lefts)) + (_.set tuple (_.at last_index_right tuple))))] (runtime: (tuple//left lefts tuple) (with_vars [last_index_right] (<| (_.while (_.boolean true)) - ($_ _.then - (_.define last_index_right (..last_index tuple)) - (_.if (_.> lefts last_index_right) - ... No need for recursion - (_.return (_.at lefts tuple)) - ... Needs recursion - <recur>))))) + (all _.then + (_.define last_index_right (..last_index tuple)) + (_.if (_.> lefts last_index_right) + ... No need for recursion + (_.return (_.at lefts tuple)) + ... Needs recursion + <recur>))))) (runtime: (tuple//right lefts tuple) (with_vars [last_index_right right_index] (<| (_.while (_.boolean true)) - ($_ _.then - (_.define last_index_right (..last_index tuple)) - (_.define right_index (_.+ (_.i32 +1) lefts)) - (<| (_.if (_.= last_index_right right_index) - (_.return (_.at right_index tuple))) - (_.if (_.> last_index_right right_index) - ... Needs recursion. - <recur>) - (_.return (_.do "slice" (list right_index) tuple))) - ))))) + (all _.then + (_.define last_index_right (..last_index tuple)) + (_.define right_index (_.+ (_.i32 +1) lefts)) + (<| (_.if (_.= last_index_right right_index) + (_.return (_.at right_index tuple))) + (_.if (_.> last_index_right right_index) + ... Needs recursion. + <recur>) + (_.return (_.do "slice" (list right_index) tuple))) + ))))) (def: .public variant_tag_field "_lux_tag") (def: .public variant_flag_field "_lux_flag") @@ -176,11 +176,11 @@ (let [@this (_.var "this")] (with_vars [tag is_last value] (_.closure (list tag is_last value) - ($_ _.then - (_.set (_.the ..variant_tag_field @this) tag) - (_.set (_.the ..variant_flag_field @this) is_last) - (_.set (_.the ..variant_value_field @this) value) - ))))) + (all _.then + (_.set (_.the ..variant_tag_field @this) tag) + (_.set (_.the ..variant_flag_field @this) is_last) + (_.set (_.the ..variant_value_field @this) value) + ))))) (def: .public (variant tag last? value) (-> Expression Expression Expression Computation) @@ -192,11 +192,11 @@ actual##right? (|> sum (_.the ..variant_flag_field)) actual##value (|> sum (_.the ..variant_value_field)) is_last? (_.= ..unit actual##right?) - recur! ($_ _.then - (_.set expected##lefts (|> expected##lefts - (_.- actual##lefts) - (_.- (_.i32 +1)))) - (_.set sum actual##value))] + recur! (all _.then + (_.set expected##lefts (|> expected##lefts + (_.- actual##lefts) + (_.- (_.i32 +1)))) + (_.set sum actual##value))] (<| (_.while (_.boolean true)) (_.if (_.= expected##lefts actual##lefts) (_.if (_.= expected##right? actual##right?) @@ -232,12 +232,12 @@ (def: runtime//structure Statement - ($_ _.then - @tuple//left - @tuple//right - @variant//new - @sum//get - )) + (all _.then + @tuple//left + @tuple//right + @variant//new + @sum//get + )) (runtime: (lux//try op) (with_vars [ex] @@ -246,22 +246,22 @@ (runtime: (lux//program_args inputs) (with_vars [output idx] - ($_ _.then - (_.define output ..none) - (_.for idx - (..last_index inputs) - (_.>= (_.i32 +0) idx) - (_.-- idx) - (_.set output (..some (_.array (list (_.at idx inputs) - output))))) - (_.return output)))) + (all _.then + (_.define output ..none) + (_.for idx + (..last_index inputs) + (_.>= (_.i32 +0) idx) + (_.-- idx) + (_.set output (..some (_.array (list (_.at idx inputs) + output))))) + (_.return output)))) (def: runtime//lux Statement - ($_ _.then - @lux//try - @lux//program_args - )) + (all _.then + @lux//try + @lux//program_args + )) (def: .public i64_low_field Text "_lux_low") (def: .public i64_high_field Text "_lux_high") @@ -270,10 +270,10 @@ (let [@this (_.var "this")] (with_vars [high low] (_.closure (list high low) - ($_ _.then - (_.set (_.the ..i64_high_field @this) high) - (_.set (_.the ..i64_low_field @this) low) - ))))) + (all _.then + (_.set (_.the ..i64_high_field @this) high) + (_.set (_.the ..i64_low_field @this) low) + ))))) (def: .public (i64 high low) (-> Expression Expression Computation) @@ -309,58 +309,58 @@ (|>> (_.< (_.i32 +32)))) (runtime: (i64##left_shifted input shift) - ($_ _.then - (..cap_shift! shift) - (_.return (<| (..no_shift! shift input) - (_.? (..small_shift? shift) - (let [high (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift shift)) - (|> input (_.the ..i64_low_field) (_.logic_right_shift (_.- shift (_.i32 +32))))) - low (|> input (_.the ..i64_low_field) (_.left_shift shift))] - (..i64 high low))) - (let [high (|> input (_.the ..i64_low_field) (_.left_shift (_.- (_.i32 +32) shift)))] - (..i64 high (_.i32 +0))))) - )) + (all _.then + (..cap_shift! shift) + (_.return (<| (..no_shift! shift input) + (_.? (..small_shift? shift) + (let [high (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift shift)) + (|> input (_.the ..i64_low_field) (_.logic_right_shift (_.- shift (_.i32 +32))))) + low (|> input (_.the ..i64_low_field) (_.left_shift shift))] + (..i64 high low))) + (let [high (|> input (_.the ..i64_low_field) (_.left_shift (_.- (_.i32 +32) shift)))] + (..i64 high (_.i32 +0))))) + )) (runtime: (i64##arithmetic_right_shifted input shift) - ($_ _.then - (..cap_shift! shift) - (_.return (<| (..no_shift! shift input) - (_.? (..small_shift? shift) - (let [high (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift shift)) - low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift) - (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))] - (..i64 high low))) - (let [high (_.? (|> input (_.the ..i64_high_field) (_.>= (_.i32 +0))) - (_.i32 +0) - (_.i32 -1)) - low (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift (_.- (_.i32 +32) shift)))] - (..i64 high low)))))) + (all _.then + (..cap_shift! shift) + (_.return (<| (..no_shift! shift input) + (_.? (..small_shift? shift) + (let [high (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift shift)) + low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift) + (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))] + (..i64 high low))) + (let [high (_.? (|> input (_.the ..i64_high_field) (_.>= (_.i32 +0))) + (_.i32 +0) + (_.i32 -1)) + low (|> input (_.the ..i64_high_field) (_.arithmetic_right_shift (_.- (_.i32 +32) shift)))] + (..i64 high low)))))) (runtime: (i64##right_shifted input shift) - ($_ _.then - (..cap_shift! shift) - (_.return (<| (..no_shift! shift input) - (_.? (..small_shift? shift) - (let [high (|> input (_.the ..i64_high_field) (_.logic_right_shift shift)) - low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift) - (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))] - (..i64 high low))) - (_.? (|> shift (_.= (_.i32 +32))) - (..i64 (_.i32 +0) (|> input (_.the ..i64_high_field)))) - (..i64 (_.i32 +0) - (|> input (_.the ..i64_high_field) (_.logic_right_shift (_.- (_.i32 +32) shift)))))))) + (all _.then + (..cap_shift! shift) + (_.return (<| (..no_shift! shift input) + (_.? (..small_shift? shift) + (let [high (|> input (_.the ..i64_high_field) (_.logic_right_shift shift)) + low (|> input (_.the ..i64_low_field) (_.logic_right_shift shift) + (_.bit_or (|> input (_.the ..i64_high_field) (_.left_shift (_.- shift (_.i32 +32))))))] + (..i64 high low))) + (_.? (|> shift (_.= (_.i32 +32))) + (..i64 (_.i32 +0) (|> input (_.the ..i64_high_field)))) + (..i64 (_.i32 +0) + (|> input (_.the ..i64_high_field) (_.logic_right_shift (_.- (_.i32 +32) shift)))))))) (def: runtime//bit Statement - ($_ _.then - @i64##and - @i64##or - @i64##xor - @i64##not - @i64##left_shifted - @i64##arithmetic_right_shifted - @i64##right_shifted - )) + (all _.then + @i64##and + @i64##or + @i64##xor + @i64##not + @i64##left_shifted + @i64##arithmetic_right_shifted + @i64##right_shifted + )) (runtime: i64##2^16 (_.left_shift (_.i32 +16) (_.i32 +1))) @@ -416,38 +416,38 @@ (with_vars [l48 l32 l16 l00 r48 r32 r16 r00 x48 x32 x16 x00] - ($_ _.then - (_.define l48 (hh subject)) - (_.define l32 (hl subject)) - (_.define l16 (lh subject)) - (_.define l00 (ll subject)) - - (_.define r48 (hh parameter)) - (_.define r32 (hl parameter)) - (_.define r16 (lh parameter)) - (_.define r00 (ll parameter)) - - (_.define x00 (_.+ l00 r00)) - - (_.define x16 (|> (high_16 x00) - (_.+ l16) - (_.+ r16))) - (_.set x00 (low_16 x00)) - - (_.define x32 (|> (high_16 x16) - (_.+ l32) - (_.+ r32))) - (_.set x16 (low_16 x16)) - - (_.define x48 (|> (high_16 x32) - (_.+ l48) - (_.+ r48) - low_16)) - (_.set x32 (low_16 x32)) - - (_.return (..i64 (_.bit_or (up_16 x48) x32) - (_.bit_or (up_16 x16) x00))) - )))) + (all _.then + (_.define l48 (hh subject)) + (_.define l32 (hl subject)) + (_.define l16 (lh subject)) + (_.define l00 (ll subject)) + + (_.define r48 (hh parameter)) + (_.define r32 (hl parameter)) + (_.define r16 (lh parameter)) + (_.define r00 (ll parameter)) + + (_.define x00 (_.+ l00 r00)) + + (_.define x16 (|> (high_16 x00) + (_.+ l16) + (_.+ r16))) + (_.set x00 (low_16 x00)) + + (_.define x32 (|> (high_16 x16) + (_.+ l32) + (_.+ r32))) + (_.set x16 (low_16 x16)) + + (_.define x48 (|> (high_16 x32) + (_.+ l48) + (_.+ r48) + low_16)) + (_.set x32 (low_16 x32)) + + (_.return (..i64 (_.bit_or (up_16 x48) x32) + (_.bit_or (up_16 x16) x00))) + )))) (runtime: (i64##opposite value) (_.return (_.? (i64##= i64##min value) @@ -483,56 +483,56 @@ (with_vars [l48 l32 l16 l00 r48 r32 r16 r00 x48 x32 x16 x00] - ($_ _.then - (_.define l48 (hh subject)) - (_.define l32 (hl subject)) - (_.define l16 (lh subject)) - (_.define l00 (ll subject)) - - (_.define r48 (hh parameter)) - (_.define r32 (hl parameter)) - (_.define r16 (lh parameter)) - (_.define r00 (ll parameter)) - - (_.define x00 (_.* l00 r00)) - (_.define x16 (high_16 x00)) - (_.set x00 (low_16 x00)) - - (_.set x16 (|> x16 (_.+ (_.* l16 r00)))) - (_.define x32 (high_16 x16)) (_.set x16 (low_16 x16)) - (_.set x16 (|> x16 (_.+ (_.* l00 r16)))) - (_.set x32 (|> x32 (_.+ (high_16 x16)))) (_.set x16 (low_16 x16)) - - (_.set x32 (|> x32 (_.+ (_.* l32 r00)))) - (_.define x48 (high_16 x32)) (_.set x32 (low_16 x32)) - (_.set x32 (|> x32 (_.+ (_.* l16 r16)))) - (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32)) - (_.set x32 (|> x32 (_.+ (_.* l00 r32)))) - (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32)) - - (_.set x48 (|> x48 - (_.+ (_.* l48 r00)) - (_.+ (_.* l32 r16)) - (_.+ (_.* l16 r32)) - (_.+ (_.* l00 r48)) - low_16)) - - (_.return (..i64 (_.bit_or (up_16 x48) x32) - (_.bit_or (up_16 x16) x00))) - )))) + (all _.then + (_.define l48 (hh subject)) + (_.define l32 (hl subject)) + (_.define l16 (lh subject)) + (_.define l00 (ll subject)) + + (_.define r48 (hh parameter)) + (_.define r32 (hl parameter)) + (_.define r16 (lh parameter)) + (_.define r00 (ll parameter)) + + (_.define x00 (_.* l00 r00)) + (_.define x16 (high_16 x00)) + (_.set x00 (low_16 x00)) + + (_.set x16 (|> x16 (_.+ (_.* l16 r00)))) + (_.define x32 (high_16 x16)) (_.set x16 (low_16 x16)) + (_.set x16 (|> x16 (_.+ (_.* l00 r16)))) + (_.set x32 (|> x32 (_.+ (high_16 x16)))) (_.set x16 (low_16 x16)) + + (_.set x32 (|> x32 (_.+ (_.* l32 r00)))) + (_.define x48 (high_16 x32)) (_.set x32 (low_16 x32)) + (_.set x32 (|> x32 (_.+ (_.* l16 r16)))) + (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32)) + (_.set x32 (|> x32 (_.+ (_.* l00 r32)))) + (_.set x48 (|> x48 (_.+ (high_16 x32)))) (_.set x32 (low_16 x32)) + + (_.set x48 (|> x48 + (_.+ (_.* l48 r00)) + (_.+ (_.* l32 r16)) + (_.+ (_.* l16 r32)) + (_.+ (_.* l00 r48)) + low_16)) + + (_.return (..i64 (_.bit_or (up_16 x48) x32) + (_.bit_or (up_16 x16) x00))) + )))) (runtime: (i64##< parameter subject) (let [negative? (|>> (_.the ..i64_high_field) (_.< (_.i32 +0)))] (with_vars [-subject? -parameter?] - ($_ _.then - (_.define -subject? (negative? subject)) - (_.define -parameter? (negative? parameter)) - (_.return (<| (_.? (_.and -subject? (_.not -parameter?)) - (_.boolean true)) - (_.? (_.and (_.not -subject?) -parameter?) - (_.boolean false)) - (negative? (i64##- parameter subject)))) - )))) + (all _.then + (_.define -subject? (negative? subject)) + (_.define -parameter? (negative? parameter)) + (_.return (<| (_.? (_.and -subject? (_.not -parameter?)) + (_.boolean true)) + (_.? (_.and (_.not -subject?) -parameter?) + (_.boolean false)) + (negative? (i64##- parameter subject)))) + )))) (def: (i64##<= param subject) (-> Expression Expression Expression) @@ -555,20 +555,20 @@ (_.return i64##one)) (with_vars [approximation] (let [subject/2 (..i64##arithmetic_right_shifted subject (_.i32 +1))] - ($_ _.then - (_.define approximation (i64##left_shifted (i64##/ parameter - subject/2) - (_.i32 +1))) - (_.if (i64##= i64##zero approximation) - (_.return (_.? (..negative? parameter) - i64##one - i64##-one)) - (let [remainder (i64##- (i64##* approximation - parameter) - subject)] - (_.return (i64##+ (i64##/ parameter - remainder) - approximation))))))))) + (all _.then + (_.define approximation (i64##left_shifted (i64##/ parameter + subject/2) + (_.i32 +1))) + (_.if (i64##= i64##zero approximation) + (_.return (_.? (..negative? parameter) + i64##one + i64##-one)) + (let [remainder (i64##- (i64##* approximation + parameter) + subject)] + (_.return (i64##+ (i64##/ parameter + remainder) + approximation))))))))) (_.if (i64##= i64##min parameter) (_.return i64##zero)) (_.if (..negative? subject) @@ -580,43 +580,43 @@ (_.if (..negative? parameter) (_.return (i64##opposite (i64##/ (i64##opposite parameter) subject)))) (with_vars [result remainder] - ($_ _.then - (_.define result i64##zero) - (_.define remainder subject) - (_.while (i64##<= remainder parameter) - (with_vars [approximate approximate_result approximate_remainder log2 delta] - (let [approximate_result' (i64##of_number approximate) - approx_remainder (i64##* parameter approximate_result)] - ($_ _.then - (_.define approximate (|> (i64##number remainder) - (_./ (i64##number parameter)) - (_.apply_1 (_.var "Math.floor")) - (_.apply_2 (_.var "Math.max") (_.i32 +1)))) - (_.define log2 (|> approximate - (_.apply_1 (_.var "Math.log")) - (_./ (_.var "Math.LN2")) - (_.apply_1 (_.var "Math.ceil")))) - (_.define delta (_.? (_.> (_.i32 +48) log2) - (_.apply_2 (_.var "Math.pow") - (_.i32 +2) - (_.- (_.i32 +48) - log2)) - (_.i32 +1))) - (_.define approximate_result approximate_result') - (_.define approximate_remainder approx_remainder) - (_.while (_.or (..negative? approximate_remainder) - (i64##< approximate_remainder - remainder)) - ($_ _.then - (_.set approximate (_.- delta approximate)) - (_.set approximate_result approximate_result') - (_.set approximate_remainder approx_remainder))) - (_.set result (i64##+ (_.? (i64##= i64##zero approximate_result) - i64##one - approximate_result) - result)) - (_.set remainder (i64##- approximate_remainder remainder)))))) - (_.return result))))) + (all _.then + (_.define result i64##zero) + (_.define remainder subject) + (_.while (i64##<= remainder parameter) + (with_vars [approximate approximate_result approximate_remainder log2 delta] + (let [approximate_result' (i64##of_number approximate) + approx_remainder (i64##* parameter approximate_result)] + (all _.then + (_.define approximate (|> (i64##number remainder) + (_./ (i64##number parameter)) + (_.apply_1 (_.var "Math.floor")) + (_.apply_2 (_.var "Math.max") (_.i32 +1)))) + (_.define log2 (|> approximate + (_.apply_1 (_.var "Math.log")) + (_./ (_.var "Math.LN2")) + (_.apply_1 (_.var "Math.ceil")))) + (_.define delta (_.? (_.> (_.i32 +48) log2) + (_.apply_2 (_.var "Math.pow") + (_.i32 +2) + (_.- (_.i32 +48) + log2)) + (_.i32 +1))) + (_.define approximate_result approximate_result') + (_.define approximate_remainder approx_remainder) + (_.while (_.or (..negative? approximate_remainder) + (i64##< approximate_remainder + remainder)) + (all _.then + (_.set approximate (_.- delta approximate)) + (_.set approximate_result approximate_result') + (_.set approximate_remainder approx_remainder))) + (_.set result (i64##+ (_.? (i64##= i64##zero approximate_result) + i64##one + approximate_result) + result)) + (_.set remainder (i64##- approximate_remainder remainder)))))) + (_.return result))))) (runtime: (i64##% parameter subject) (let [flat (|> subject @@ -626,39 +626,39 @@ (def: runtime//i64 Statement - ($_ _.then - ..runtime//bit - - @i64##2^16 - @i64##2^32 - @i64##2^64 - @i64##2^63 - @i64##unsigned_low - @i64##new - @i64##zero - @i64##min - @i64##max - @i64##one - @i64##= - @i64##+ - @i64##opposite - @i64##-one - @i64##number - @i64##of_number - @i64##- - @i64##* - @i64##< - @i64##/ - @i64##% - )) + (all _.then + ..runtime//bit + + @i64##2^16 + @i64##2^32 + @i64##2^64 + @i64##2^63 + @i64##unsigned_low + @i64##new + @i64##zero + @i64##min + @i64##max + @i64##one + @i64##= + @i64##+ + @i64##opposite + @i64##-one + @i64##number + @i64##of_number + @i64##- + @i64##* + @i64##< + @i64##/ + @i64##% + )) (runtime: (text//index start part text) (with_vars [idx] - ($_ _.then - (_.define idx (|> text (_.do "indexOf" (list part (i64##number start))))) - (_.return (_.? (_.= (_.i32 -1) idx) - ..none - (..some (i64##of_number idx))))))) + (all _.then + (_.define idx (|> text (_.do "indexOf" (list part (i64##number start))))) + (_.return (_.? (_.= (_.i32 -1) idx) + ..none + (..some (i64##of_number idx))))))) (runtime: (text//clip offset length text) (_.return (|> text (_.do "substring" (list (_.the ..i64_low_field offset) @@ -667,19 +667,19 @@ (runtime: (text//char idx text) (with_vars [result] - ($_ _.then - (_.define result (|> text (_.do "charCodeAt" (list (_.the ..i64_low_field idx))))) - (_.if (_.not_a_number? result) - (_.throw (_.string "[Lux Error] Cannot get char from text.")) - (_.return (i64##of_number result)))))) + (all _.then + (_.define result (|> text (_.do "charCodeAt" (list (_.the ..i64_low_field idx))))) + (_.if (_.not_a_number? result) + (_.throw (_.string "[Lux Error] Cannot get char from text.")) + (_.return (i64##of_number result)))))) (def: runtime//text Statement - ($_ _.then - @text//index - @text//clip - @text//char - )) + (all _.then + @text//index + @text//clip + @text//char + )) (runtime: (io//log message) (let [console (_.var "console") @@ -687,16 +687,16 @@ end! (_.return ..unit)] (<| (_.if (|> console _.type_of (_.= (_.string "undefined")) _.not (_.and (_.the "log" console))) - ($_ _.then - (_.statement (|> console (_.do "log" (list message)))) - end!)) + (all _.then + (_.statement (|> console (_.do "log" (list message)))) + end!)) (_.if (|> print _.type_of (_.= (_.string "undefined")) _.not) - ($_ _.then - (_.statement (_.apply_1 print (_.? (_.= (_.string "string") - (_.type_of message)) - message - (_.apply_1 (_.var "JSON.stringify") message)))) - end!)) + (all _.then + (_.statement (_.apply_1 print (_.? (_.= (_.string "string") + (_.type_of message)) + message + (_.apply_1 (_.var "JSON.stringify") message)))) + end!)) end!))) (runtime: (io//error message) @@ -704,65 +704,65 @@ (def: runtime//io Statement - ($_ _.then - @io//log - @io//error - )) + (all _.then + @io//log + @io//error + )) (runtime: (js//get object field) (with_vars [temp] - ($_ _.then - (_.define temp (_.at field object)) - (_.return (_.? (_.= _.undefined temp) - ..none - (..some temp)))))) + (all _.then + (_.define temp (_.at field object)) + (_.return (_.? (_.= _.undefined temp) + ..none + (..some temp)))))) (runtime: (js//set object field input) - ($_ _.then - (_.set (_.at field object) input) - (_.return object))) + (all _.then + (_.set (_.at field object) input) + (_.return object))) (runtime: (js//delete object field) - ($_ _.then - (_.statement (_.delete (_.at field object))) - (_.return object))) + (all _.then + (_.statement (_.delete (_.at field object))) + (_.return object))) (def: runtime//js Statement - ($_ _.then - @js//get - @js//set - @js//delete - )) + (all _.then + @js//get + @js//set + @js//delete + )) (runtime: (array//write idx value array) - ($_ _.then - (_.set (_.at (_.the ..i64_low_field idx) array) value) - (_.return array))) + (all _.then + (_.set (_.at (_.the ..i64_low_field idx) array) value) + (_.return array))) (runtime: (array//delete idx array) - ($_ _.then - (_.statement (_.delete (_.at (_.the ..i64_low_field idx) array))) - (_.return array))) + (all _.then + (_.statement (_.delete (_.at (_.the ..i64_low_field idx) array))) + (_.return array))) (def: runtime//array Statement - ($_ _.then - @array//write - @array//delete - )) + (all _.then + @array//write + @array//delete + )) (def: runtime Statement - ($_ _.then - runtime//structure - runtime//i64 - runtime//text - runtime//io - runtime//js - runtime//array - runtime//lux - )) + (all _.then + runtime//structure + runtime//i64 + runtime//text + runtime//io + runtime//js + runtime//array + runtime//lux + )) (def: module_id 0) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index 4e237921c..455121d02 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -46,9 +46,9 @@ 1 _.pop 2 _.pop2 _ ... (n.> 2) - ($_ _.composite - _.pop2 - (pop_alt (n.- 2 stack_depth))))) + (all _.composite + _.pop2 + (pop_alt (n.- 2 stack_depth))))) (def: int (-> (I64 Any) (Bytecode Any)) @@ -60,34 +60,34 @@ (def: peek (Bytecode Any) - ($_ _.composite - _.dup - (//runtime.get //runtime.stack_head))) + (all _.composite + _.dup + (//runtime.get //runtime.stack_head))) (def: pop (Bytecode Any) - ($_ _.composite - (//runtime.get //runtime.stack_tail) - (_.checkcast //type.stack))) + (all _.composite + (//runtime.get //runtime.stack_tail) + (_.checkcast //type.stack))) (def: (left_projection lefts) (-> Nat (Bytecode Any)) - ($_ _.composite - (_.checkcast //type.tuple) - (..int lefts) - (.case lefts - 0 - _.aaload - - lefts - //runtime.left_projection))) + (all _.composite + (_.checkcast //type.tuple) + (..int lefts) + (.case lefts + 0 + _.aaload + + lefts + //runtime.left_projection))) (def: (right_projection lefts) (-> Nat (Bytecode Any)) - ($_ _.composite - (_.checkcast //type.tuple) - (..int lefts) - //runtime.right_projection)) + (all _.composite + (_.checkcast //type.tuple) + (..int lefts) + //runtime.right_projection)) (def: equals@Object (.let [class (type.class "java.lang.Object" (list)) @@ -96,9 +96,9 @@ (def: (path|bind register) (-> Register (Operation (Bytecode Any))) - (operation#in ($_ _.composite - ..peek - (_.astore register)))) + (operation#in (all _.composite + ..peek + (_.astore register)))) (def: (path|bit_fork again @else [when thenP elseP]) (-> (-> Path (Operation (Bytecode Any))) @@ -115,13 +115,13 @@ .let [if! (.if when _.ifeq _.ifne)]] (in (do _.monad [@else _.new_label] - ($_ _.composite - ..peek - (//value.unwrap type.boolean) - (if! @else) - then! - (_.set_label @else) - else!))))) + (all _.composite + ..peek + (//value.unwrap type.boolean) + (if! @else) + then! + (_.set_label @else) + else!))))) (template [<name> <type> <unwrap> <dup> <pop> <test> <comparison> <if>] [(def: (<name> again @else cons) @@ -134,23 +134,23 @@ [then! (again thenP)] (in (do _.monad [@else _.new_label] - ($_ _.composite - <dup> - (<test> test) - <comparison> - (<if> @else) - <pop> - then! - (_.set_label @else) - else!))))) - ($_ _.composite - <pop> - (_.goto @else)) + (all _.composite + <dup> + (<test> test) + <comparison> + (<if> @else) + <pop> + then! + (_.set_label @else) + else!))))) + (all _.composite + <pop> + (_.goto @else)) {.#Item cons})] - (in ($_ _.composite - ..peek - <unwrap> - fork!))))] + (in (all _.composite + ..peek + <unwrap> + fork!))))] [path|i64_fork (I64 Any) (//value.unwrap type.long) _.dup2 _.pop2 ..long _.lcmp _.ifne] [path|f64_fork Frac (//value.unwrap type.double) _.dup2 _.pop2 _.double _.dcmpl _.ifne] @@ -178,34 +178,34 @@ {synthesis.#Then bodyS} (do phase.monad [body! (phase archive bodyS)] - (in ($_ _.composite - (..pop_alt stack_depth) - body! - (_.when_continuous (_.goto @end))))) + (in (all _.composite + (..pop_alt stack_depth) + body! + (_.when_continuous (_.goto @end))))) (pattern (synthesis.side lefts right?)) (operation#in (do _.monad [@success _.new_label] - ($_ _.composite - ..peek - (_.checkcast //type.variant) - (//structure.lefts lefts) - (//structure.right? right?) - //runtime.case - _.dup - (_.ifnonnull @success) - _.pop - (_.goto @else) - (_.set_label @success) - //runtime.push))) + (all _.composite + ..peek + (_.checkcast //type.variant) + (//structure.lefts lefts) + (//structure.right? right?) + //runtime.case + _.dup + (_.ifnonnull @success) + _.pop + (_.goto @else) + (_.set_label @success) + //runtime.push))) (^.template [<pattern> <projection>] [(pattern (<pattern> lefts)) - (operation#in ($_ _.composite - ..peek - (<projection> lefts) - //runtime.push)) + (operation#in (all _.composite + ..peek + (<projection> lefts) + //runtime.push)) ... Extra optimization (pattern (synthesis.path/seq @@ -213,11 +213,11 @@ (synthesis.!bind_top register thenP))) (do phase.monad [then! (path' stack_depth @else @end phase archive thenP)] - (in ($_ _.composite - ..peek - (<projection> lefts) - (_.astore register) - then!)))]) + (in (all _.composite + ..peek + (<projection> lefts) + (_.astore register) + then!)))]) ([synthesis.member/left ..left_projection] [synthesis.member/right ..right_projection]) @@ -225,21 +225,21 @@ (do phase.monad [left! (path' stack_depth @else @end phase archive leftP) right! (path' stack_depth @else @end phase archive rightP)] - (in ($_ _.composite - left! - right!))) + (in (all _.composite + left! + right!))) {synthesis.#Alt leftP rightP} (do phase.monad [@alt_else //runtime.forge_label left! (path' (++ stack_depth) @alt_else @end phase archive leftP) right! (path' stack_depth @else @end phase archive rightP)] - (in ($_ _.composite - _.dup - left! - (_.set_label @alt_else) - _.pop - right!))) + (in (all _.composite + _.dup + left! + (_.set_label @alt_else) + _.pop + right!))) ))) (def: (path @end phase archive path) @@ -247,15 +247,15 @@ (do phase.monad [@else //runtime.forge_label path! (..path' 1 @else @end phase archive path)] - (in ($_ _.composite - path! - (<| (_.when_acknowledged @else) - ($_ _.composite - (_.set_label @else) - //runtime.pm_failure - (_.goto @end) - )) - )))) + (in (all _.composite + path! + (<| (_.when_acknowledged @else) + (all _.composite + (_.set_label @else) + //runtime.pm_failure + (_.goto @end) + )) + )))) (def: .public (if phase archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -266,36 +266,36 @@ (in (do _.monad [@else _.new_label @end _.new_label] - ($_ _.composite - test! - (//value.unwrap type.boolean) - (_.ifeq @else) - then! - (_.when_continuous (_.goto @end)) - (_.set_label @else) - else! - (<| (_.when_acknowledged @end) - (_.set_label @end))))))) + (all _.composite + test! + (//value.unwrap type.boolean) + (_.ifeq @else) + then! + (_.when_continuous (_.goto @end)) + (_.set_label @else) + else! + (<| (_.when_acknowledged @end) + (_.set_label @end))))))) (def: .public (exec phase archive [this that]) (Generator [Synthesis Synthesis]) (do phase.monad [this! (phase archive this) that! (phase archive that)] - (in ($_ _.composite - this! - _.pop - that!)))) + (in (all _.composite + this! + _.pop + that!)))) (def: .public (let phase archive [inputS register bodyS]) (Generator [Synthesis Register Synthesis]) (do phase.monad [input! (phase archive inputS) body! (phase archive bodyS)] - (in ($_ _.composite - input! - (_.astore register) - body!)))) + (in (all _.composite + input! + (_.astore register) + body!)))) (def: .public (get phase archive [path recordS]) (Generator [(List Member) Synthesis]) @@ -305,9 +305,9 @@ (.let [next! (.if (the member.#right? step) (..right_projection (the member.#lefts step)) (..left_projection (the member.#lefts step)))] - ($_ _.composite - so_far! - next!))) + (all _.composite + so_far! + next!))) record! (list.reversed path))))) @@ -317,10 +317,10 @@ [@end //runtime.forge_label value! (phase archive valueS) path! (..path @end phase archive path)] - (in ($_ _.composite - _.aconst_null - value! - //runtime.push - path! - (<| (_.when_acknowledged @end) - (_.set_label @end)))))) + (in (all _.composite + _.aconst_null + value! + //runtime.push + path! + (<| (_.when_acknowledged @end) + (_.set_label @end)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index 1de6aba52..77f1a415f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -92,9 +92,9 @@ (def: modifier (Modifier Class) - ($_ modifier#composite - class.public - class.final)) + (all modifier#composite + class.public + class.final)) (def: this_offset 1) @@ -131,18 +131,18 @@ (Generator [(Bytecode Any) (List Synthesis)]) (do [! phase.monad] [inputsG (monad.each ! (generate archive) inputsS)] - (in ($_ _.composite - abstractionG - (|> inputsG - (list.sub /arity.maximum) - (monad.each _.monad - (function (_ batchG) - ($_ _.composite - (_.checkcast /abstract.class) - (monad.all _.monad batchG) - (_.invokevirtual /abstract.class //runtime.apply::name (//runtime.apply::type (list.size batchG))) - )))) - )))) + (in (all _.composite + abstractionG + (|> inputsG + (list.sub /arity.maximum) + (monad.each _.monad + (function (_ batchG) + (all _.composite + (_.checkcast /abstract.class) + (monad.all _.monad batchG) + (_.invokevirtual /abstract.class //runtime.apply::name (//runtime.apply::type (list.size batchG))) + )))) + )))) (def: (apply/? generate archive [abstractionS inputsS]) (Generator Apply) @@ -156,11 +156,11 @@ [.let [:abstraction: (type.class (//runtime.class_name @abstraction) (list))] abstractionG (//reference.constant archive $abstraction) inputsG (monad.each ! (generate archive) inputsS)] - (in ($_ _.composite - abstractionG - (monad.all _.monad inputsG) - (/implementation.call :abstraction: arity) - )))) + (in (all _.composite + abstractionG + (monad.all _.monad inputsG) + (/implementation.call :abstraction: arity) + )))) (def: (apply/> generate archive [$abstraction @abstraction arity inputsS]) (Generator [Symbol unit.ID Arity (List Synthesis)]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux index 7d0bc8ae0..bccc114a9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/constant.lux @@ -1,25 +1,25 @@ (.using - [library - [lux {"-" Type type} - [data - [collection - ["[0]" sequence]]] - [target - [jvm - ["[0]" field {"+" Field}] - ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] - [type {"+" Type} - [category {"+" Value}]] - [constant - [pool {"+" Resource}]]]]]]) + [library + [lux {"-" Type type} + [data + [collection + ["[0]" sequence]]] + [target + [jvm + ["[0]" field {"+" Field}] + ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] + [type {"+" Type} + [category {"+" Value}]] + [constant + [pool {"+" Resource}]]]]]]) (def: modifier (Modifier Field) - ($_ modifier#composite - field.public - field.static - field.final - )) + (all modifier#composite + field.public + field.static + field.final + )) (def: .public (constant name type) (-> Text (Type Value) (Resource Field)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux index 4e0684215..179fdb273 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable.lux @@ -1,48 +1,48 @@ (.using - [library - [lux {"-" Type type} - [data - [collection - ["[0]" list ("[1]#[0]" functor)] - ["[0]" sequence]]] - [target - [jvm - ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] - ["[0]" field {"+" Field}] - ["_" bytecode {"+" Bytecode}] - [type {"+" Type} - [category {"+" Value Class}]] - [constant - [pool {"+" Resource}]]]]]] - ["[0]" //// "_" - ["[1][0]" type] - ["[1][0]" reference] - [////// - [reference - [variable {"+" Register}]]]]) + [library + [lux {"-" Type type} + [data + [collection + ["[0]" list ("[1]#[0]" functor)] + ["[0]" sequence]]] + [target + [jvm + ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] + ["[0]" field {"+" Field}] + ["_" bytecode {"+" Bytecode}] + [type {"+" Type} + [category {"+" Value Class}]] + [constant + [pool {"+" Resource}]]]]]] + ["[0]" //// "_" + ["[1][0]" type] + ["[1][0]" reference] + [////// + [reference + [variable {"+" Register}]]]]) (def: .public type ////type.value) (def: .public (get class name) (-> (Type Class) Text (Bytecode Any)) - ($_ _.composite - ////reference.this - (_.getfield class name ..type) - )) + (all _.composite + ////reference.this + (_.getfield class name ..type) + )) (def: .public (put naming class register value) (-> (-> Register Text) (Type Class) Register (Bytecode Any) (Bytecode Any)) - ($_ _.composite - ////reference.this - value - (_.putfield class (naming register) ..type))) + (all _.composite + ////reference.this + value + (_.putfield class (naming register) ..type))) (def: modifier (Modifier Field) - ($_ modifier#composite - field.private - field.final - )) + (all modifier#composite + field.private + field.final + )) (def: .public (variable name type) (-> Text (Type Value) (Resource Field)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux index a73192e16..c3a960653 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/count.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" type} - [control - ["[0]" try]] - [target - [jvm - ["_" bytecode {"+" Bytecode}] - ["[0]" type] - [encoding - [name {"+" External}] - ["[0]" signed]]]]]] - ["[0]" //// "_" - ["[1][0]" abstract]]) + [library + [lux {"-" type} + [control + ["[0]" try]] + [target + [jvm + ["_" bytecode {"+" Bytecode}] + ["[0]" type] + [encoding + [name {"+" External}] + ["[0]" signed]]]]]] + ["[0]" //// "_" + ["[1][0]" abstract]]) (def: .public field "partials") (def: .public type type.int) @@ -28,7 +28,7 @@ (def: .public value (Bytecode Any) - ($_ _.composite - ..this - (_.getfield ////abstract.class ..field ..type) - )) + (all _.composite + ..this + (_.getfield ////abstract.class ..field ..type) + )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux index a0880a4e2..d6f86409c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial.lux @@ -31,11 +31,11 @@ (def: .public (initial amount) (-> Nat (Bytecode Any)) - ($_ _.composite - (|> _.aconst_null - (list.repeated amount) - (monad.all _.monad)) - (_#in []))) + (all _.composite + (|> _.aconst_null + (list.repeated amount) + (monad.all _.monad)) + (_#in []))) (def: .public (get class register) (-> (Type Class) Register (Bytecode Any)) @@ -52,7 +52,7 @@ (def: .public (new arity) (-> Arity (Bytecode Any)) (if (arity.multiary? arity) - ($_ _.composite - //count.initial - (initial (n.- ///arity.minimum arity))) + (all _.composite + //count.initial + (initial (n.- ///arity.minimum arity))) (_#in []))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux index 2f7a0afe3..e684f86bc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method.lux @@ -1,14 +1,14 @@ (.using - [library - [lux "*" - [target - [jvm - ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] - ["[0]" method {"+" Method}]]]]]) + [library + [lux "*" + [target + [jvm + ["[0]" modifier {"+" Modifier} ("[1]#[0]" monoid)] + ["[0]" method {"+" Method}]]]]]) (def: .public modifier (Modifier Method) - ($_ modifier#composite - method.public - method.strict - )) + (all modifier#composite + method.public + method.strict + )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index cd8ecbbb5..e4b3c7802 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -50,31 +50,31 @@ (def: (increment by) (-> Nat (Bytecode Any)) - ($_ _.composite - (<| _.int .i64 by) - _.iadd)) + (all _.composite + (<| _.int .i64 by) + _.iadd)) (def: (inputs offset amount) (-> Register Nat (Bytecode Any)) - ($_ _.composite - (|> amount - list.indices - (monad.each _.monad (|>> (n.+ offset) _.aload))) - (_#in []) - )) + (all _.composite + (|> amount + list.indices + (monad.each _.monad (|>> (n.+ offset) _.aload))) + (_#in []) + )) (def: (apply offset amount) (-> Register Nat (Bytecode Any)) (let [arity (n.min amount ///arity.maximum)] - ($_ _.composite - (_.checkcast ///abstract.class) - (..inputs offset arity) - (_.invokevirtual ///abstract.class ////runtime.apply::name (////runtime.apply::type arity)) - (if (n.> ///arity.maximum amount) - (apply (n.+ ///arity.maximum offset) - (n.- ///arity.maximum amount)) - (_#in [])) - ))) + (all _.composite + (_.checkcast ///abstract.class) + (..inputs offset arity) + (_.invokevirtual ///abstract.class ////runtime.apply::name (////runtime.apply::type arity)) + (if (n.> ///arity.maximum amount) + (apply (n.+ ///arity.maximum offset) + (n.- ///arity.maximum amount)) + (_#in [])) + ))) (def: this_offset 1) @@ -87,11 +87,11 @@ #0 (////runtime.apply::type apply_arity) (list) {.#Some (case num_partials - 0 ($_ _.composite - ////reference.this - (..inputs ..this_offset apply_arity) - (//implementation.call class function_arity) - _.areturn) + 0 (all _.composite + ////reference.this + (..inputs ..this_offset apply_arity) + (//implementation.call class function_arity) + _.areturn) _ (do _.monad [@default _.new_label @labelsH _.new_label @@ -108,51 +108,51 @@ already_partial? (n.> 0 stage) exact_match? (i.= over_extent (.int stage)) has_more_than_necessary? (i.> over_extent (.int stage))] - ($_ _.composite - (_.set_label @case) - (cond exact_match? - ($_ _.composite - ////reference.this - (if already_partial? - (_.invokevirtual class //reset.name (//reset.type class)) - (_#in [])) - current_partials - (..inputs ..this_offset apply_arity) - (//implementation.call class function_arity) - _.areturn) - - has_more_than_necessary? - (let [arity_inputs (|> function_arity (n.- stage)) - additional_inputs (|> apply_arity (n.- arity_inputs))] - ($_ _.composite + (all _.composite + (_.set_label @case) + (cond exact_match? + (all _.composite ////reference.this - (_.invokevirtual class //reset.name (//reset.type class)) + (if already_partial? + (_.invokevirtual class //reset.name (//reset.type class)) + (_#in [])) current_partials - (..inputs ..this_offset arity_inputs) + (..inputs ..this_offset apply_arity) (//implementation.call class function_arity) - (apply (n.+ ..this_offset arity_inputs) additional_inputs) - _.areturn)) + _.areturn) + + has_more_than_necessary? + (let [arity_inputs (|> function_arity (n.- stage)) + additional_inputs (|> apply_arity (n.- arity_inputs))] + (all _.composite + ////reference.this + (_.invokevirtual class //reset.name (//reset.type class)) + current_partials + (..inputs ..this_offset arity_inputs) + (//implementation.call class function_arity) + (apply (n.+ ..this_offset arity_inputs) additional_inputs) + _.areturn)) - ... (i.< over_extent (.int stage)) - (let [current_environment (|> (list.indices (list.size environment)) - (list#each (///foreign.get class)) - (monad.all _.monad)) - missing_partials (|> _.aconst_null - (list.repeated (|> num_partials (n.- apply_arity) (n.- stage))) - (monad.all _.monad))] - ($_ _.composite - (_.new class) - _.dup - current_environment - ///count.value - (..increment apply_arity) - current_partials - (..inputs ..this_offset apply_arity) - missing_partials - (_.invokespecial class //init.name (//init.type environment function_arity)) - _.areturn))))))) + ... (i.< over_extent (.int stage)) + (let [current_environment (|> (list.indices (list.size environment)) + (list#each (///foreign.get class)) + (monad.all _.monad)) + missing_partials (|> _.aconst_null + (list.repeated (|> num_partials (n.- apply_arity) (n.- stage))) + (monad.all _.monad))] + (all _.composite + (_.new class) + _.dup + current_environment + ///count.value + (..increment apply_arity) + current_partials + (..inputs ..this_offset apply_arity) + missing_partials + (_.invokespecial class //init.name (//init.type environment function_arity)) + _.areturn))))))) (monad.all _.monad))]] - ($_ _.composite - ///count.value - (_.tableswitch (try.trusted (signed.s4 +0)) @default [@labelsH @labelsT]) - cases)))}))) + (all _.composite + ///count.value + (_.tableswitch (try.trusted (signed.s4 +0)) @default [@labelsH @labelsT]) + cases)))}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index 165c3e502..eb17c5044 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -36,10 +36,10 @@ (list)])) (def: modifier - ($_ modifier#composite - method.static - //.modifier - )) + (all modifier#composite + method.static + //.modifier + )) (def: .public (method :it: arity @begin body) (-> (Type Class) Arity Label (Bytecode Any) (Resource Method)) @@ -47,11 +47,11 @@ ..name #0 (..type :it: arity) (list) - {.#Some ($_ _.composite - (_.set_label @begin) - body - (_.when_continuous _.areturn) - )})) + {.#Some (all _.composite + (_.set_label @begin) + body + (_.when_continuous _.areturn) + )})) (def: .public (call :it: arity) (-> (Type Class) Arity (Bytecode Any)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index 554f0cb8e..d909c1aaf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -67,11 +67,11 @@ (def: .public (super environment_size arity) (-> Nat Arity (Bytecode Any)) (let [arity_register (++ environment_size)] - ($_ _.composite - (if (arity.unary? arity) - ..no_partials - (_.iload arity_register)) - (_.invokespecial ///abstract.class ..name ///abstract.init)))) + (all _.composite + (if (arity.unary? arity) + ..no_partials + (_.iload arity_register)) + (_.invokespecial ///abstract.class ..name ///abstract.init)))) (def: (store_all amount put offset) (-> Nat @@ -96,9 +96,9 @@ (method.method //.modifier ..name #0 (..type environment arity) (list) - {.#Some ($_ _.composite - ////reference.this - (..super environment_size arity) - (store_all environment_size (///foreign.put class) offset_foreign) - (store_all (-- arity) (///partial.put class) offset_partial) - _.return)}))) + {.#Some (all _.composite + ////reference.this + (..super environment_size arity) + (store_all environment_size (///foreign.put class) offset_foreign) + (store_all (-- arity) (///partial.put class) offset_partial) + _.return)}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux index 5087f0357..06c0b32d3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux @@ -45,12 +45,12 @@ (def: .public (instance' foreign_setup class environment arity) (-> (List (Bytecode Any)) (Type Class) (Environment Synthesis) Arity (Bytecode Any)) - ($_ _.composite - (_.new class) - _.dup - (monad.all _.monad foreign_setup) - (///partial.new arity) - (_.invokespecial class //init.name (//init.type environment arity)))) + (all _.composite + (_.new class) + _.dup + (monad.all _.monad foreign_setup) + (///partial.new arity) + (_.invokespecial class //init.name (//init.type environment arity)))) (def: .public (instance generate archive class environment arity) (-> Phase Archive (Type Class) (Environment Synthesis) Arity (Operation (Bytecode Any))) @@ -70,13 +70,13 @@ (method.method //.modifier //init.name #0 (//init.type environment arity) (list) - {.#Some ($_ _.composite - ////reference.this - (//init.super environment_size arity) - (monad.each _.monad (function (_ register) - (///foreign.put class register (_.aload (after_this register)))) - (list.indices environment_size)) - (monad.each _.monad (function (_ register) - (///partial.put class register (_.aload (after_arity register)))) - (list.indices (n.- ///arity.minimum arity))) - _.areturn)}))) + {.#Some (all _.composite + ////reference.this + (//init.super environment_size arity) + (monad.each _.monad (function (_ register) + (///foreign.put class register (_.aload (after_this register)))) + (list.indices environment_size)) + (monad.each _.monad (function (_ register) + (///partial.put class register (_.aload (after_arity register)))) + (list.indices (n.- ///arity.minimum arity))) + _.areturn)}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index 037f2958d..ea9f1fc21 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -1,30 +1,30 @@ (.using - [library - [lux {"-" Type type} - [data - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [target - [jvm - ["[0]" method {"+" Method}] - ["_" bytecode {"+" Bytecode}] - [constant - [pool {"+" Resource}]] - ["[0]" type {"+" Type} - ["[0]" category {"+" Class}]]]]]] - ["[0]" // - ["[1][0]" new] + [library + [lux {"-" Type type} + [data + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [target + [jvm + ["[0]" method {"+" Method}] + ["_" bytecode {"+" Bytecode}] + [constant + [pool {"+" Resource}]] + ["[0]" type {"+" Type} + ["[0]" category {"+" Class}]]]]]] + ["[0]" // + ["[1][0]" new] + ["/[1]" // "_" + [field + [variable + ["[1][0]" foreign]]] ["/[1]" // "_" - [field - [variable - ["[1][0]" foreign]]] - ["/[1]" // "_" - ["[1][0]" reference] - [//// - [analysis {"+" Environment}] - [synthesis {"+" Synthesis}] - [/// - ["[0]" arity {"+" Arity}]]]]]]) + ["[1][0]" reference] + [//// + [analysis {"+" Environment}] + [synthesis {"+" Synthesis}] + [/// + ["[0]" arity {"+" Arity}]]]]]]) (def: .public name "reset") @@ -43,8 +43,8 @@ (method.method //.modifier ..name #0 (..type class) (list) - {.#Some ($_ _.composite - (if (arity.multiary? arity) - (//new.instance' (..current_environment class environment) class environment arity) - ////reference.this) - _.areturn)})) + {.#Some (all _.composite + (if (arity.multiary? arity) + (//new.instance' (..current_environment class environment) class environment arity) + ////reference.this) + _.areturn)})) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index d512d7050..d9f873984 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -62,10 +62,10 @@ (import: java/lang/ClassLoader "[1]::[0]") -(def: value::modifier ($_ modifier#composite field.public field.final field.static)) +(def: value::modifier (all modifier#composite field.public field.final field.static)) (def: init::type (type.method [(list) (list) type.void (list)])) -(def: init::modifier ($_ modifier#composite method.public method.static method.strict)) +(def: init::modifier (all modifier#composite method.public method.static method.strict)) (exception: .public (cannot_load [class Text error Text]) @@ -126,10 +126,10 @@ #0 ..init::type (list) {.#Some - ($_ _.composite - valueG - (_.putstatic (type.class bytecode_name (list)) //value.field :value:) - _.return)})) + (all _.composite + valueG + (_.putstatic (type.class bytecode_name (list)) //value.field :value:) + _.return)})) (sequence.sequence))] (io.run! (do [! (try.with io.monad)] [bytecode (# ! each (format.result class.writer) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux index 0d510baa6..167e22442 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux @@ -54,23 +54,23 @@ [fetchG (translate archive updateS) .let [storeG (_.astore register)]] (in [fetchG storeG]))))))] - (in ($_ _.composite - ... It may look weird that first I fetch all the values separately, - ... and then I store them all. - ... It must be done that way in order to avoid a potential bug. - ... Let's say that you'll recur with 2 expressions: X and Y. - ... If Y depends on the value of X, and you don't perform fetches - ... and stores separately, then by the time Y is evaluated, it - ... will refer to the new value of X, instead of the old value, as - ... should be the case. - (|> updatesG - (list#each product.left) - (monad.all _.monad)) - (|> updatesG - list.reversed - (list#each product.right) - (monad.all _.monad)) - (_.goto @begin))))) + (in (all _.composite + ... It may look weird that first I fetch all the values separately, + ... and then I store them all. + ... It must be done that way in order to avoid a potential bug. + ... Let's say that you'll recur with 2 expressions: X and Y. + ... If Y depends on the value of X, and you don't perform fetches + ... and stores separately, then by the time Y is evaluated, it + ... will refer to the new value of X, instead of the old value, as + ... should be the case. + (|> updatesG + (list#each product.left) + (monad.all _.monad)) + (|> updatesG + list.reversed + (list#each product.right) + (monad.all _.monad)) + (_.goto @begin))))) (def: .public (scope translate archive [offset initsS+ iterationS]) (Generator [Nat (List Synthesis) Synthesis]) @@ -82,13 +82,13 @@ .let [initializationG (list#each (function (_ [index initG]) [initG (_.astore (n.+ offset index))]) (list.enumeration initsI+))]] - (in ($_ _.composite - (|> initializationG - (list#each product.left) - (monad.all _.monad)) - (|> initializationG - list.reversed - (list#each product.right) - (monad.all _.monad)) - (_.set_label @begin) - iterationG)))) + (in (all _.composite + (|> initializationG + (list#each product.left) + (monad.all _.monad)) + (|> initializationG + list.reversed + (list#each product.right) + (monad.all _.monad)) + (_.set_label @begin) + iterationG)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index 2b761e907..dacdd2318 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -47,67 +47,67 @@ (def: main::modifier (Modifier Method) - ($_ modifier#composite - method.public - method.static - method.strict - )) + (all modifier#composite + method.public + method.static + method.strict + )) (def: program::modifier (Modifier Class) - ($_ modifier#composite - class.public - class.final - )) + (all modifier#composite + class.public + class.final + )) (def: list:end //runtime.none_injection) (def: amount_of_inputs (Bytecode Any) - ($_ _.composite - _.aload_0 - _.arraylength)) + (all _.composite + _.aload_0 + _.arraylength)) (def: decrease (Bytecode Any) - ($_ _.composite - _.iconst_1 - _.isub)) + (all _.composite + _.iconst_1 + _.isub)) (def: head (Bytecode Any) - ($_ _.composite - _.dup - _.aload_0 - _.swap - _.aaload - _.swap - _.dup_x2 - _.pop)) + (all _.composite + _.dup + _.aload_0 + _.swap + _.aaload + _.swap + _.dup_x2 + _.pop)) (def: pair (Bytecode Any) - (let [empty_pair ($_ _.composite - _.iconst_2 - (_.anewarray ^Object) - ) + (let [empty_pair (all _.composite + _.iconst_2 + (_.anewarray ^Object) + ) set_side! (is (-> (Bytecode Any) (Bytecode Any)) (function (_ index) - ($_ _.composite - ... ?P - _.dup_x1 ... P?P - _.swap ... PP? - index ... PP?I - _.swap ... PPI? - _.aastore ... P - )))] - ($_ _.composite - ... RL - empty_pair ... RLP - (set_side! _.iconst_0) ... RP - (set_side! _.iconst_1) ... P - ))) + (all _.composite + ... ?P + _.dup_x1 ... P?P + _.swap ... PP? + index ... PP?I + _.swap ... PPI? + _.aastore ... P + )))] + (all _.composite + ... RL + empty_pair ... RLP + (set_side! _.iconst_0) ... RP + (set_side! _.iconst_1) ... P + ))) (def: list:item //runtime.right_injection) @@ -116,30 +116,30 @@ (do _.monad [@loop _.new_label @end _.new_label] - ($_ _.composite - ..list:end - ..amount_of_inputs - (_.set_label @loop) - ..decrease - _.dup - (_.iflt @end) - ..head - ..pair - ..list:item - _.swap - (_.goto @loop) - (_.set_label @end) - _.pop))) + (all _.composite + ..list:end + ..amount_of_inputs + (_.set_label @loop) + ..decrease + _.dup + (_.iflt @end) + ..head + ..pair + ..list:item + _.swap + (_.goto @loop) + (_.set_label @end) + _.pop))) (def: feed_inputs //runtime.apply) (def: run_io (Bytecode Any) - ($_ _.composite - (_.checkcast //function/abstract.class) - //runtime.unit - //runtime.apply)) + (all _.composite + (_.checkcast //function/abstract.class) + //runtime.unit + //runtime.apply)) (def: .public (program artifact_name context program) (-> (-> unit.ID Text) (Program (Bytecode Any) Definition)) @@ -147,12 +147,12 @@ main (method.method ..main::modifier "main" #0 ..main::type (list) - {.#Some ($_ _.composite - program - ..input_list - ..feed_inputs - ..run_io - _.return)}) + {.#Some (all _.composite + program + ..input_list + ..feed_inputs + ..run_io + _.return)}) class (artifact_name context)] [class (<| (format.result class.writer) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux index cc36c0cd2..725952b30 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux @@ -44,11 +44,11 @@ (do [! ////.monad] [bytecode_name (# ! each //runtime.class_name (generation.context archive))] - (in ($_ _.composite - ..this - (_.getfield (type.class bytecode_name (list)) - (..foreign_name variable) - //type.value))))) + (in (all _.composite + ..this + (_.getfield (type.class bytecode_name (list)) + (..foreign_name variable) + //type.value))))) (def: .public (variable archive variable) (-> Archive Variable (Operation (Bytecode Any))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index 136c1c359..cb82ec642 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -109,11 +109,11 @@ (def: modifier (Modifier Method) - ($_ modifier#composite - method.public - method.static - method.strict - )) + (all modifier#composite + method.public + method.static + method.strict + )) (def: this (Bytecode Any) @@ -121,19 +121,19 @@ (def: .public (get index) (-> (Bytecode Any) (Bytecode Any)) - ($_ _.composite - index - _.aaload)) + (all _.composite + index + _.aaload)) (def: (set! index value) (-> (Bytecode Any) (Bytecode Any) (Bytecode Any)) - ($_ _.composite - ... A - _.dup ... AA - index ... AAI - value ... AAIV - _.aastore ... A - )) + (all _.composite + ... A + _.dup ... AA + index ... AAI + value ... AAIV + _.aastore ... A + )) (def: .public unit (_.string synthesis.unit)) @@ -146,70 +146,70 @@ (def: variant_value _.iconst_2) (def: variant::method - (let [new_variant ($_ _.composite - _.iconst_3 - (_.anewarray //type.value)) - $lefts ($_ _.composite - _.iload_0 - (//value.wrap type.int)) + (let [new_variant (all _.composite + _.iconst_3 + (_.anewarray //type.value)) + $lefts (all _.composite + _.iload_0 + (//value.wrap type.int)) $right? _.aload_1 $value _.aload_2] (method.method ..modifier ..variant::name #0 ..variant::type (list) - {.#Some ($_ _.composite - new_variant ... A[3] - (..set! ..variant_lefts $lefts) ... A[3] - (..set! ..variant_right? $right?) ... A[3] - (..set! ..variant_value $value) ... A[3] - _.areturn)}))) + {.#Some (all _.composite + new_variant ... A[3] + (..set! ..variant_lefts $lefts) ... A[3] + (..set! ..variant_right? $right?) ... A[3] + (..set! ..variant_value $value) ... A[3] + _.areturn)}))) (def: .public left_right? _.aconst_null) (def: .public right_right? ..unit) (def: .public left_injection (Bytecode Any) - ($_ _.composite - _.iconst_0 - ..left_right? - _.dup2_x1 - _.pop2 - ..variant)) + (all _.composite + _.iconst_0 + ..left_right? + _.dup2_x1 + _.pop2 + ..variant)) (def: .public right_injection (Bytecode Any) - ($_ _.composite - _.iconst_0 - ..right_right? - _.dup2_x1 - _.pop2 - ..variant)) + (all _.composite + _.iconst_0 + ..right_right? + _.dup2_x1 + _.pop2 + ..variant)) (def: .public some_injection ..right_injection) (def: .public none_injection (Bytecode Any) - ($_ _.composite - _.iconst_0 - ..left_right? - ..unit - ..variant)) + (all _.composite + _.iconst_0 + ..left_right? + ..unit + ..variant)) (def: (risky $unsafe) (-> (Bytecode Any) (Bytecode Any)) (do _.monad [@try _.new_label @handler _.new_label] - ($_ _.composite - (_.try @try @handler @handler //type.error) - (_.set_label @try) - $unsafe - ..some_injection - _.areturn - (_.set_label @handler) - ..none_injection - _.areturn - ))) + (all _.composite + (_.try @try @handler @handler //type.error) + (_.set_label @try) + $unsafe + ..some_injection + _.areturn + (_.set_label @handler) + ..none_injection + _.areturn + ))) (def: decode_frac::name "decode_frac") (def: decode_frac::type (type.method [(list) (list //type.text) //type.variant (list)])) @@ -221,11 +221,11 @@ (list) {.#Some (..risky - ($_ _.composite - _.aload_0 - (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)])) - (//value.wrap type.double) - ))})) + (all _.composite + _.aload_0 + (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)])) + (//value.wrap type.double) + ))})) (def: .public log! (Bytecode Any) @@ -234,19 +234,19 @@ out (_.getstatic ^System "out" ^PrintStream) print_type (type.method [(list) (list //type.value) type.void (list)]) print! (function (_ method) (_.invokevirtual ^PrintStream method print_type))] - ($_ _.composite - out (_.string "LUX LOG: ") (print! "print") - out _.swap (print! "println")))) + (all _.composite + out (_.string "LUX LOG: ") (print! "print") + out _.swap (print! "println")))) (def: exception_constructor (type.method [(list) (list //type.text) type.void (list)])) (def: (illegal_state_exception message) (-> Text (Bytecode Any)) (let [^IllegalStateException (type.class "java.lang.IllegalStateException" (list))] - ($_ _.composite - (_.new ^IllegalStateException) - _.dup - (_.string message) - (_.invokespecial ^IllegalStateException "<init>" ..exception_constructor)))) + (all _.composite + (_.new ^IllegalStateException) + _.dup + (_.string message) + (_.invokespecial ^IllegalStateException "<init>" ..exception_constructor)))) (def: failure::type (type.method [(list) (list) type.void (list)])) @@ -257,9 +257,9 @@ #0 ..failure::type (list) {.#Some - ($_ _.composite - (..illegal_state_exception message) - _.athrow)})) + (all _.composite + (..illegal_state_exception message) + _.athrow)})) (def: pm_failure::name "pm_failure") (def: .public pm_failure (..procedure ..pm_failure::name ..failure::type)) @@ -279,16 +279,16 @@ #0 ..push::type (list) {.#Some - (let [new_stack_frame! ($_ _.composite - _.iconst_2 - (_.anewarray //type.value)) + (let [new_stack_frame! (all _.composite + _.iconst_2 + (_.anewarray //type.value)) $head _.aload_1 $tail _.aload_0] - ($_ _.composite - new_stack_frame! - (..set! ..stack_head $head) - (..set! ..stack_tail $tail) - _.areturn))})) + (all _.composite + new_stack_frame! + (..set! ..stack_head $head) + (..set! ..stack_tail $tail) + _.areturn))})) (def: case::name "case") (def: case::type (type.method [(list) (list //type.variant //type.lefts //type.right?) //type.value (list)])) @@ -309,67 +309,67 @@ $lefts _.iload_1 $right? _.aload_2 - ::lefts ($_ _.composite - (..get ..variant_lefts) - (//value.unwrap type.int)) + ::lefts (all _.composite + (..get ..variant_lefts) + (//value.unwrap type.int)) ::right? (..get ..variant_right?) ::value (..get ..variant_value) not_found _.aconst_null - super_nested_lefts ($_ _.composite - _.swap - _.isub - (_.int (i32.i32 (.i64 +1))) - _.isub) - super_nested ($_ _.composite - ... lefts, sumT - super_nested_lefts ... super_lefts - $variant ::right? ... super_lefts, super_right - $variant ::value ... super_lefts, super_right, super_value - ..variant) - - update_$variant ($_ _.composite - $variant ::value - (_.checkcast //type.variant) - _.astore_0) - update_$lefts ($_ _.composite - _.isub - (_.int (i32.i32 (.i64 +1))) - _.isub) + super_nested_lefts (all _.composite + _.swap + _.isub + (_.int (i32.i32 (.i64 +1))) + _.isub) + super_nested (all _.composite + ... lefts, sumT + super_nested_lefts ... super_lefts + $variant ::right? ... super_lefts, super_right + $variant ::value ... super_lefts, super_right, super_value + ..variant) + + update_$variant (all _.composite + $variant ::value + (_.checkcast //type.variant) + _.astore_0) + update_$lefts (all _.composite + _.isub + (_.int (i32.i32 (.i64 +1))) + _.isub) again (is (-> Label (Bytecode Any)) (function (_ @) - ($_ _.composite - ... lefts, sumT - update_$variant ... lefts, sumT - update_$lefts ... sub_lefts - (_.goto @))))]] - ($_ _.composite - $lefts - (_.set_label @loop) - $variant ::lefts - _.dup2 (_.if_icmpeq @lefts_match!) - _.dup2 (_.if_icmpgt @maybe_nested) - $right? (_.ifnull @mismatch!) ... lefts, sumT - super_nested ... super_variant - _.areturn - (_.set_label @lefts_match!) ... lefts, sumT - $right? ... lefts, sumT, wants_right? - $variant ::right? ... lefts, sumT, wants_right?, is_right? - (_.if_acmpeq @perfect_match!) ... lefts, sumT - (_.set_label @mismatch!) ... lefts, sumT - ... _.pop2 - not_found - _.areturn - (_.set_label @maybe_nested) ... lefts, sumT - $variant ::right? ... lefts, sumT, right? - (_.ifnull @mismatch!) ... lefts, sumT - (again @loop) - (_.set_label @perfect_match!) ... lefts, sumT - ... _.pop2 - $variant ::value - _.areturn - ))})) + (all _.composite + ... lefts, sumT + update_$variant ... lefts, sumT + update_$lefts ... sub_lefts + (_.goto @))))]] + (all _.composite + $lefts + (_.set_label @loop) + $variant ::lefts + _.dup2 (_.if_icmpeq @lefts_match!) + _.dup2 (_.if_icmpgt @maybe_nested) + $right? (_.ifnull @mismatch!) ... lefts, sumT + super_nested ... super_variant + _.areturn + (_.set_label @lefts_match!) ... lefts, sumT + $right? ... lefts, sumT, wants_right? + $variant ::right? ... lefts, sumT, wants_right?, is_right? + (_.if_acmpeq @perfect_match!) ... lefts, sumT + (_.set_label @mismatch!) ... lefts, sumT + ... _.pop2 + not_found + _.areturn + (_.set_label @maybe_nested) ... lefts, sumT + $variant ::right? ... lefts, sumT, right? + (_.ifnull @mismatch!) ... lefts, sumT + (again @loop) + (_.set_label @perfect_match!) ... lefts, sumT + ... _.pop2 + $variant ::value + _.areturn + ))})) (def: projection_type (type.method [(list) (list //type.tuple //type.offset) //type.value (list)])) @@ -382,29 +382,29 @@ (def: projection::method2 [(Resource Method) (Resource Method)] (let [$tuple _.aload_0 - $tuple::size ($_ _.composite - $tuple - _.arraylength) + $tuple::size (all _.composite + $tuple + _.arraylength) $lefts _.iload_1 - $last_right ($_ _.composite - $tuple::size - _.iconst_1 - _.isub) - - update_$lefts ($_ _.composite - $lefts $last_right _.isub - _.istore_1) - update_$tuple ($_ _.composite - $tuple $last_right _.aaload (_.checkcast //type.tuple) - _.astore_0) + $last_right (all _.composite + $tuple::size + _.iconst_1 + _.isub) + + update_$lefts (all _.composite + $lefts $last_right _.isub + _.istore_1) + update_$tuple (all _.composite + $tuple $last_right _.aaload (_.checkcast //type.tuple) + _.astore_0) recur (is (-> Label (Bytecode Any)) (function (_ @loop) - ($_ _.composite - update_$lefts - update_$tuple - (_.goto @loop)))) + (all _.composite + update_$lefts + update_$tuple + (_.goto @loop)))) left_projection::method (method.method ..modifier ..left_projection::name @@ -414,17 +414,17 @@ (do _.monad [@loop _.new_label @recursive _.new_label - .let [::left ($_ _.composite - $lefts - _.aaload)]] - ($_ _.composite - (_.set_label @loop) - $lefts $last_right (_.if_icmpge @recursive) - $tuple ::left - _.areturn - (_.set_label @recursive) - ... Recursive - (recur @loop)))}) + .let [::left (all _.composite + $lefts + _.aaload)]] + (all _.composite + (_.set_label @loop) + $lefts $last_right (_.if_icmpge @recursive) + $tuple ::left + _.areturn + (_.set_label @recursive) + ... Recursive + (recur @loop)))}) right_projection::method (method.method ..modifier ..right_projection::name @@ -435,34 +435,34 @@ [@loop _.new_label @not_tail _.new_label @slice _.new_label - .let [$right ($_ _.composite - $lefts - _.iconst_1 - _.iadd) - $::nested ($_ _.composite - $tuple - _.swap - _.aaload) - super_nested ($_ _.composite - $tuple - $right - $tuple::size - (_.invokestatic (type.class "java.util.Arrays" (list)) "copyOfRange" - (type.method [(list) (list //type.tuple //type.index //type.index) //type.tuple (list)])))]] - ($_ _.composite - (_.set_label @loop) - $last_right $right - _.dup2 (_.if_icmpne @not_tail) - ... _.pop - $::nested - _.areturn - (_.set_label @not_tail) - (_.if_icmpgt @slice) - ... Must recurse - (recur @loop) - (_.set_label @slice) - super_nested - _.areturn))})] + .let [$right (all _.composite + $lefts + _.iconst_1 + _.iadd) + $::nested (all _.composite + $tuple + _.swap + _.aaload) + super_nested (all _.composite + $tuple + $right + $tuple::size + (_.invokestatic (type.class "java.util.Arrays" (list)) "copyOfRange" + (type.method [(list) (list //type.tuple //type.index //type.index) //type.tuple (list)])))]] + (all _.composite + (_.set_label @loop) + $last_right $right + _.dup2 (_.if_icmpne @not_tail) + ... _.pop + $::nested + _.areturn + (_.set_label @not_tail) + (_.if_icmpgt @slice) + ... Must recurse + (recur @loop) + (_.set_label @slice) + super_nested + _.areturn))})] [left_projection::method right_projection::method])) @@ -493,44 +493,44 @@ .let [$unsafe ..this ^StringWriter (type.class "java.io.StringWriter" (list)) - string_writer ($_ _.composite - (_.new ^StringWriter) - _.dup - (_.invokespecial ^StringWriter "<init>" (type.method [(list) (list) type.void (list)]))) + string_writer (all _.composite + (_.new ^StringWriter) + _.dup + (_.invokespecial ^StringWriter "<init>" (type.method [(list) (list) type.void (list)]))) ^PrintWriter (type.class "java.io.PrintWriter" (list)) - print_writer ($_ _.composite - ... WTW - (_.new ^PrintWriter) ... WTWP - _.dup_x1 ... WTPWP - _.swap ... WTPPW - ..true ... WTPPWZ - (_.invokespecial ^PrintWriter "<init>" (type.method [(list) (list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) - ... WTP - ) - unsafe_application ($_ _.composite - $unsafe - ..unit - ..apply) - stack_trace ($_ _.composite - ... T - string_writer ... TW - _.dup_x1 ... WTW - print_writer ... WTP - (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ... W - (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ... S - )]] - ($_ _.composite - (_.try @try @handler @handler //type.error) - (_.set_label @try) - unsafe_application - ..right_injection - _.areturn - (_.set_label @handler) ... T - stack_trace ... S - ..left_injection - _.areturn - ))})) + print_writer (all _.composite + ... WTW + (_.new ^PrintWriter) ... WTWP + _.dup_x1 ... WTPWP + _.swap ... WTPPW + ..true ... WTPPWZ + (_.invokespecial ^PrintWriter "<init>" (type.method [(list) (list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) + ... WTP + ) + unsafe_application (all _.composite + $unsafe + ..unit + ..apply) + stack_trace (all _.composite + ... T + string_writer ... TW + _.dup_x1 ... WTW + print_writer ... WTP + (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ... W + (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ... S + )]] + (all _.composite + (_.try @try @handler @handler //type.error) + (_.set_label @try) + unsafe_application + ..right_injection + _.areturn + (_.set_label @handler) ... T + stack_trace ... S + ..left_injection + _.areturn + ))})) (def: reflection (All (_ category) @@ -543,9 +543,9 @@ (Operation [artifact.ID (Maybe Text) Binary]) (let [class (..reflection ..class) modifier (is (Modifier Class) - ($_ modifier#composite - class.public - class.final)) + (all modifier#composite + class.public + class.final)) bytecode (<| (format.result class.writer) try.trusted (class.class jvm/version.v6_0 @@ -585,13 +585,13 @@ (let [previous_inputs (|> arity list.indices (monad.each _.monad _.aload))] - ($_ _.composite - previous_inputs - (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity))) - (_.checkcast //function.class) - (_.aload arity) - (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum)) - _.areturn))}))) + (all _.composite + previous_inputs + (_.invokevirtual //function.class ..apply::name (..apply::type (-- arity))) + (_.checkcast //function.class) + (_.aload arity) + (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum)) + _.areturn))}))) (partial_list (method.method (modifier#composite method.public method.abstract) ..apply::name #0 (..apply::type //function/arity.minimum) @@ -602,17 +602,17 @@ (list) {.#Some (let [$partials _.iload_1] - ($_ _.composite - ..this - (_.invokespecial ^Object "<init>" (type.method [(list) (list) type.void (list)])) - ..this - $partials - (_.putfield //function.class //function/count.field //function/count.type) - _.return))}) + (all _.composite + ..this + (_.invokespecial ^Object "<init>" (type.method [(list) (list) type.void (list)])) + ..this + $partials + (_.putfield //function.class //function/count.field //function/count.type) + _.return))}) modifier (is (Modifier Class) - ($_ modifier#composite - class.public - class.abstract)) + (all modifier#composite + class.public + class.abstract)) class (..reflection //function.class) partial_count (is (Resource Field) (field.field (modifier#composite field.public field.final) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux index 0bef710e1..e40b7d122 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux @@ -1,12 +1,12 @@ (.using - [library - [lux {"-" Type Primitive type} - [target - [jvm - ["_" bytecode {"+" Bytecode}] - ["[0]" type {"+" Type} ("[1]#[0]" equivalence) - [category {"+" Primitive}] - ["[0]" box]]]]]]) + [library + [lux {"-" Type Primitive type} + [target + [jvm + ["_" bytecode {"+" Bytecode}] + ["[0]" type {"+" Type} ("[1]#[0]" equivalence) + [category {"+" Primitive}] + ["[0]" box]]]]]]) (def: .public field "value") @@ -44,6 +44,6 @@ (def: .public (unwrap type) (-> (Type Primitive) (Bytecode Any)) (let [wrapper (type.class (primitive_wrapper type) (list))] - ($_ _.composite - (_.checkcast wrapper) - (_.invokevirtual wrapper (primitive_unwrap type) (type.method [(list) (list) type (list)]))))) + (all _.composite + (_.checkcast wrapper) + (_.invokevirtual wrapper (primitive_unwrap type) (type.method [(list) (list) type (list)]))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 2c35a85bd..18776639d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -56,9 +56,9 @@ [this (expression archive this) that (statement expression archive that) $dummy (# ! each _.var (/////generation.symbol "_exec"))] - (in ($_ _.then - (_.set (list $dummy) this) - that)))) + (in (all _.then + (_.set (list $dummy) this) + that)))) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) @@ -76,9 +76,9 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (in ($_ _.then - (_.local/1 (..register register) valueO) - bodyO)))) + (in (all _.then + (_.local/1 (..register register) valueO) + bodyO)))) (def: .public (get expression archive [pathP valueS]) (Generator [(List Member) Synthesis]) @@ -154,15 +154,15 @@ (template [<name> <flag>] [(def: (<name> simple? idx) (-> Bit Nat Statement) - ($_ _.then - (_.set (list @temp) (//runtime.sum//get ..peek <flag> - (|> idx .int _.int))) - (.if simple? - (_.when (_.= _.nil @temp) - fail!) - (_.if (_.= _.nil @temp) - fail! - (..push! @temp)))))] + (all _.then + (_.set (list @temp) (//runtime.sum//get ..peek <flag> + (|> idx .int _.int))) + (.if simple? + (_.when (_.= _.nil @temp) + fail!) + (_.if (_.= _.nil @temp) + fail! + (..push! @temp)))))] [left_choice _.nil] [right_choice //runtime.unit] @@ -170,14 +170,14 @@ (def: (alternation pre! post!) (-> Statement Statement Statement) - ($_ _.then - (_.while (_.boolean true) - ($_ _.then - ..save! - pre!)) - ($_ _.then - ..restore! - post!))) + (all _.then + (_.while (_.boolean true) + (all _.then + ..save! + pre!)) + (all _.then + ..restore! + post!))) (def: (pattern_matching' statement expression archive) (-> Phase! Phase Archive Path (Operation Statement)) @@ -248,9 +248,9 @@ (pattern (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (again thenP)] - (///////phase#in ($_ _.then - (_.local/1 (..register register) ..peek_and_pop) - then!))) + (///////phase#in (all _.then + (_.local/1 (..register register) ..peek_and_pop) + then!))) (^.template [<tag> <combinator>] [(pattern (<tag> preP postP)) @@ -265,10 +265,10 @@ (-> Phase! Phase Archive Path (Operation Statement)) (do ///////phase.monad [pattern_matching! (pattern_matching' statement expression archive pathP)] - (in ($_ _.then - (_.while (_.boolean true) - pattern_matching!) - (_.statement (|> (_.var "error") (_.apply (list (_.string ////synthesis/case.pattern_matching_error))))))))) + (in (all _.then + (_.while (_.boolean true) + pattern_matching!) + (_.statement (|> (_.var "error") (_.apply (list (_.string ////synthesis/case.pattern_matching_error))))))))) (def: .public dependencies (-> Path (List Var)) @@ -288,11 +288,11 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (in ($_ _.then - (_.local (list @temp)) - (_.local/1 @cursor (_.array (list stack_init))) - (_.local/1 @savepoint (_.array (list))) - pattern_matching!)))) + (in (all _.then + (_.local (list @temp)) + (_.local/1 @cursor (_.array (list stack_init))) + (_.local/1 @savepoint (_.array (list))) + pattern_matching!)))) (def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index c4fa6bb64..de0387fd7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -55,9 +55,9 @@ (let [@inits (|> (list.enumeration inits) (list#each (|>> product.left ..capture)))] [(_.function @self @inits - ($_ _.then - (_.local_function @self @args body!) - (_.return @self))) + (all _.then + (_.local_function @self @args body!) + (_.return @self))) (_.apply inits @self)]))) (def: input @@ -85,9 +85,9 @@ @self (_.var (///reference.artifact function_name)) initialize_self! (_.local/1 (//case.register 0) @self) initialize! (list#mix (.function (_ post pre!) - ($_ _.then - pre! - (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried)))) + (all _.then + pre! + (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried)))) initialize_self! (list.indices arity)) pack (|>> (list) _.array) @@ -96,48 +96,48 @@ (_.apply (list it) (_.var "table.unpack")))) @var_args (_.var "...")] .let [[definition instantiation] (with_closure closureO+ @self (list @var_args) - ($_ _.then - (_.local/1 @curried (pack @var_args)) - (_.local/1 @num_args (_.length @curried)) - (<| (_.if (|> @num_args (_.= arityO)) - ($_ _.then - initialize! - (_.set_label @scope) - body!)) - (_.if (|> @num_args (_.> arityO)) - (let [arity_inputs (_.apply (list @curried - (_.int +1) - arityO - (_.int +1) - (_.array (list))) - (_.var "table.move")) - extra_inputs (_.apply (list @curried - (_.+ (_.int +1) arityO) - @num_args - (_.int +1) - (_.array (list))) - (_.var "table.move"))] - (_.return (|> @self - (_.apply (list (unpack arity_inputs))) - (_.apply (list (unpack extra_inputs))))))) - ... (|> @num_args (_.< arityO)) - (_.return (_.closure (list @var_args) - (let [@extra_args (_.var "extra_args")] - ($_ _.then - (_.local/1 @extra_args (pack @var_args)) - (_.return (_.apply (list (unpack (_.apply (list @extra_args - (_.int +1) - (_.length @extra_args) - (_.+ (_.int +1) @num_args) - (_.apply (list @curried - (_.int +1) - @num_args - (_.int +1) - (_.array (list))) - (_.var "table.move"))) - (_.var "table.move")))) - @self))))))) - ))] + (all _.then + (_.local/1 @curried (pack @var_args)) + (_.local/1 @num_args (_.length @curried)) + (<| (_.if (|> @num_args (_.= arityO)) + (all _.then + initialize! + (_.set_label @scope) + body!)) + (_.if (|> @num_args (_.> arityO)) + (let [arity_inputs (_.apply (list @curried + (_.int +1) + arityO + (_.int +1) + (_.array (list))) + (_.var "table.move")) + extra_inputs (_.apply (list @curried + (_.+ (_.int +1) arityO) + @num_args + (_.int +1) + (_.array (list))) + (_.var "table.move"))] + (_.return (|> @self + (_.apply (list (unpack arity_inputs))) + (_.apply (list (unpack extra_inputs))))))) + ... (|> @num_args (_.< arityO)) + (_.return (_.closure (list @var_args) + (let [@extra_args (_.var "extra_args")] + (all _.then + (_.local/1 @extra_args (pack @var_args)) + (_.return (_.apply (list (unpack (_.apply (list @extra_args + (_.int +1) + (_.length @extra_args) + (_.+ (_.int +1) @num_args) + (_.apply (list @curried + (_.int +1) + @num_args + (_.int +1) + (_.array (list))) + (_.var "table.move"))) + (_.var "table.move")))) + @self))))))) + ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) {.#None} definition)] (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 57e35ab75..9883feaaf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -44,11 +44,11 @@ (list#each (|>> product.left (n.+ offset) //case.register)))] (if as_expression? body - ($_ _.then - (if initial? - (_.let variables (_.multi bindings)) - (_.set variables (_.multi bindings))) - body)))) + (all _.then + (if initial? + (_.let variables (_.multi bindings)) + (_.set variables (_.multi bindings))) + body)))) (def: .public (scope! statement expression archive as_expression? [start initsS+ bodyS]) ... (Generator! (Scope Synthesis)) @@ -70,9 +70,9 @@ (statement expression archive bodyS))] (in [initsO+ (..setup true start initsO+ as_expression? - ($_ _.then - (_.set_label @scope) - body!))])))) + (all _.then + (_.set_label @scope) + body!))])))) (def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -105,11 +105,11 @@ foreigns (let [@context (_.var (format (_.code @loop) "_context"))] [(_.function @context foreigns - ($_ _.then - (<| (_.local_function @loop locals) - scope!) - (_.return @loop) - )) + (all _.then + (<| (_.local_function @loop locals) + scope!) + (_.return @loop) + )) (_.apply foreigns @context)])))] _ (/////generation.execute! directive) _ (/////generation.save! artifact_id {.#None} directive)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index be52af3e7..9864bd037 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -166,49 +166,49 @@ (def: last_index (|>> _.length (_.- (_.int +1)))) -(with_expansions [<recur> (these ($_ _.then - (_.set (list lefts) (_.- last_index_right lefts)) - (_.set (list tuple) (..item last_index_right tuple))))] +(with_expansions [<recur> (these (all _.then + (_.set (list lefts) (_.- last_index_right lefts)) + (_.set (list tuple) (..item last_index_right tuple))))] (runtime: (tuple//left lefts tuple) (with_vars [last_index_right] (<| (_.while (_.boolean true)) - ($_ _.then - (_.local/1 last_index_right (..last_index tuple)) - (_.if (_.> lefts last_index_right) - ... No need for recursion - (_.return (..item lefts tuple)) - ... Needs recursion - <recur>))))) + (all _.then + (_.local/1 last_index_right (..last_index tuple)) + (_.if (_.> lefts last_index_right) + ... No need for recursion + (_.return (..item lefts tuple)) + ... Needs recursion + <recur>))))) (runtime: (tuple//right lefts tuple) (with_vars [last_index_right right_index] (<| (_.while (_.boolean true)) - ($_ _.then - (_.local/1 last_index_right (..last_index tuple)) - (_.local/1 right_index (_.+ (_.int +1) lefts)) - (<| (_.if (_.= last_index_right right_index) - (_.return (..item right_index tuple))) - (_.if (_.> last_index_right right_index) - ... Needs recursion. - <recur>) - (_.return (_.apply (list tuple - (_.+ (_.int +1) right_index) - (_.length tuple) - (_.int +1) - (_.array (list))) - (_.var "table.move")))) - ))))) + (all _.then + (_.local/1 last_index_right (..last_index tuple)) + (_.local/1 right_index (_.+ (_.int +1) lefts)) + (<| (_.if (_.= last_index_right right_index) + (_.return (..item right_index tuple))) + (_.if (_.> last_index_right right_index) + ... Needs recursion. + <recur>) + (_.return (_.apply (list tuple + (_.+ (_.int +1) right_index) + (_.length tuple) + (_.int +1) + (_.array (list))) + (_.var "table.move")))) + ))))) (runtime: (sum//get sum expected##right? expected##lefts) (let [mismatch! (_.return _.nil) actual##lefts (_.the ..variant_tag_field sum) actual##right? (_.the ..variant_flag_field sum) actual##value (_.the ..variant_value_field sum) - recur! ($_ _.then - (_.set (list expected##lefts) (|> expected##lefts - (_.- actual##lefts) - (_.- (_.int +1)))) - (_.set (list sum) actual##value))] + recur! (all _.then + (_.set (list expected##lefts) (|> expected##lefts + (_.- actual##lefts) + (_.- (_.int +1)))) + (_.set (list sum) actual##value))] (<| (_.while (_.boolean true)) (_.if (_.= expected##lefts actual##lefts) (_.if (_.= expected##right? actual##right?) @@ -228,37 +228,37 @@ (def: runtime//adt Statement - ($_ _.then - @tuple//left - @tuple//right - @sum//get - )) + (all _.then + @tuple//left + @tuple//right + @sum//get + )) (runtime: (lux//try risky) (with_vars [success value] - ($_ _.then - (_.let (list success value) (|> risky (_.apply (list ..unit)) - _.return (_.closure (list)) - list _.apply (|> (_.var "pcall")))) - (_.if success - (_.return (..right value)) - (_.return (..left value)))))) + (all _.then + (_.let (list success value) (|> risky (_.apply (list ..unit)) + _.return (_.closure (list)) + list _.apply (|> (_.var "pcall")))) + (_.if success + (_.return (..right value)) + (_.return (..left value)))))) (runtime: (lux//program_args raw) (with_vars [tail head idx] - ($_ _.then - (_.let (list tail) ..none) - (<| (_.for_step idx (_.length raw) (_.int +1) (_.int -1)) - (_.set (list tail) (..some (_.array (list (_.item idx raw) - tail))))) - (_.return tail)))) + (all _.then + (_.let (list tail) ..none) + (<| (_.for_step idx (_.length raw) (_.int +1) (_.int -1)) + (_.set (list tail) (..some (_.array (list (_.item idx raw) + tail))))) + (_.return tail)))) (def: runtime//lux Statement - ($_ _.then - @lux//try - @lux//program_args - )) + (all _.then + @lux//try + @lux//program_args + )) (def: cap_shift (_.% (_.int +64))) @@ -270,25 +270,25 @@ (let [mask (|> (_.int +1) (_.bit_shl (_.- param (_.int +64))) (_.- (_.int +1)))] - ($_ _.then - (_.set (list param) (..cap_shift param)) - (_.return (|> subject - (_.bit_shr param) - (_.bit_and mask)))))) + (all _.then + (_.set (list param) (..cap_shift param)) + (_.return (|> subject + (_.bit_shr param) + (_.bit_and mask)))))) (runtime: (i64//division param subject) (with_vars [floored] - ($_ _.then - (_.local/1 floored (_.// param subject)) - (let [potentially_floored? (_.< (_.int +0) floored) - inexact? (|> subject - (_.% param) - (_.= (_.int +0)) - _.not)] - (_.if (_.and potentially_floored? - inexact?) - (_.return (_.+ (_.int +1) floored)) - (_.return floored)))))) + (all _.then + (_.local/1 floored (_.// param subject)) + (let [potentially_floored? (_.< (_.int +0) floored) + inexact? (|> subject + (_.% param) + (_.= (_.int +0)) + _.not)] + (_.if (_.and potentially_floored? + inexact?) + (_.return (_.+ (_.int +1) floored)) + (_.return floored)))))) (runtime: (i64//remainder param subject) (_.return (_.- (|> subject (..i64//division param) (_.* param)) @@ -296,12 +296,12 @@ (def: runtime//i64 Statement - ($_ _.then - @i64//left_shifted - @i64//right_shifted - @i64//division - @i64//remainder - )) + (all _.then + @i64//left_shifted + @i64//right_shifted + @i64//division + @i64//remainder + )) (def: (find_byte_index subject param start) (-> Expression Expression Expression Expression) @@ -327,22 +327,22 @@ (_.var "_VERSION"))) (runtime: (text//index subject param start) - (with_expansions [<rembulan> ($_ _.then - (_.local/1 byte_index (|> start - (_.+ (_.int +1)) - (..find_byte_index subject param))) - (_.if (_.= _.nil byte_index) - (_.return ..none) - (_.return (..some (..lux_index byte_index))))) - <normal> ($_ _.then - (_.local/1 byte_index (|> start - (..byte_index subject) - (..find_byte_index subject param))) - (_.if (_.= _.nil byte_index) - (_.return ..none) - (_.return (..some (|> byte_index - (..char_index subject) - ..lux_index)))))] + (with_expansions [<rembulan> (all _.then + (_.local/1 byte_index (|> start + (_.+ (_.int +1)) + (..find_byte_index subject param))) + (_.if (_.= _.nil byte_index) + (_.return ..none) + (_.return (..some (..lux_index byte_index))))) + <normal> (all _.then + (_.local/1 byte_index (|> start + (..byte_index subject) + (..find_byte_index subject param))) + (_.if (_.= _.nil byte_index) + (_.return ..none) + (_.return (..some (|> byte_index + (..char_index subject) + ..lux_index)))))] (with_vars [byte_index] (for @.lua <normal> (_.if ..on_rembulan? @@ -374,18 +374,18 @@ (runtime: (text//char idx text) (with_expansions [<rembulan> (with_vars [char] - ($_ _.then - (_.local/1 char (_.apply (list text idx) - (_.var "string.byte"))) - (_.if (_.= _.nil char) - (_.statement (_.error/1 (_.string "[Lux Error] Cannot get char from text."))) - (_.return char)))) + (all _.then + (_.local/1 char (_.apply (list text idx) + (_.var "string.byte"))) + (_.if (_.= _.nil char) + (_.statement (_.error/1 (_.string "[Lux Error] Cannot get char from text."))) + (_.return char)))) <normal> (with_vars [offset char] - ($_ _.then - (_.local/1 offset (_.apply (list text idx) (_.var "utf8.offset"))) - (_.if (_.= _.nil offset) - (_.statement (_.error/1 (_.string "[Lux Error] Cannot get char from text."))) - (_.return (_.apply (list text offset) (_.var "utf8.codepoint"))))))] + (all _.then + (_.local/1 offset (_.apply (list text idx) (_.var "utf8.offset"))) + (_.if (_.= _.nil offset) + (_.statement (_.error/1 (_.string "[Lux Error] Cannot get char from text."))) + (_.return (_.apply (list text offset) (_.var "utf8.codepoint"))))))] (for @.lua <normal> (_.if ..on_rembulan? <rembulan> @@ -393,33 +393,33 @@ (def: runtime//text Statement - ($_ _.then - @text//index - @text//clip - @text//size - @text//char - )) + (all _.then + @text//index + @text//clip + @text//size + @text//char + )) (runtime: (array//write idx value array) - ($_ _.then - (_.set (list (..item idx array)) value) - (_.return array))) + (all _.then + (_.set (list (..item idx array)) value) + (_.return array))) (def: runtime//array Statement - ($_ _.then - @array//write - )) + (all _.then + @array//write + )) (def: runtime Statement - ($_ _.then - ..runtime//adt - ..runtime//lux - ..runtime//i64 - ..runtime//text - ..runtime//array - )) + (all _.then + ..runtime//adt + ..runtime//lux + ..runtime//i64 + ..runtime//text + ..runtime//array + )) (def: .public generate (Operation [Registry Output]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 761b34fab..1d2c9aea8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -59,9 +59,9 @@ (do ///////phase.monad [valueO (expression archive valueS) body! (statement expression archive bodyS)] - (in ($_ _.then - (_.set! (..register register) valueO) - body!)))) + (in (all _.then + (_.set! (..register register) valueO) + body!)))) (def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -137,14 +137,14 @@ (template [<name> <flag> <prep>] [(def: (<name> simple? idx) (-> Bit Nat Statement) - ($_ _.then - (_.set! @temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek <flag>))) - (.if simple? - (_.when (_.is_null/1 @temp) - fail!) - (_.if (_.is_null/1 @temp) - fail! - (..push! @temp)))))] + (all _.then + (_.set! @temp (|> idx <prep> .int _.int (//runtime.sum//get ..peek <flag>))) + (.if simple? + (_.when (_.is_null/1 @temp) + fail!) + (_.if (_.is_null/1 @temp) + fail! + (..push! @temp)))))] [left_choice _.null (<|)] [right_choice (_.string "") ++] @@ -152,14 +152,14 @@ (def: (alternation pre! post!) (-> Statement Statement Statement) - ($_ _.then - (_.do_while (_.bool false) - ($_ _.then - ..save! - pre!)) - ($_ _.then - ..restore! - post!))) + (all _.then + (_.do_while (_.bool false) + (all _.then + ..save! + pre!)) + (all _.then + ..restore! + post!))) (def: (pattern_matching' statement expression archive) (Generator! Path) @@ -229,15 +229,15 @@ (pattern (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (again thenP)] - (///////phase#in ($_ _.then - (_.set! (..register register) ..peek_and_pop) - then!))) + (///////phase#in (all _.then + (_.set! (..register register) ..peek_and_pop) + then!))) ... (pattern (/////synthesis.!multi_pop nextP)) ... (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] ... (do ///////phase.monad ... [next! (again nextP')] - ... (///////phase#in ($_ _.then + ... (///////phase#in (all _.then ... (..multi_pop! (n.+ 2 extra_pops)) ... next!)))) @@ -254,10 +254,10 @@ (Generator! Path) (do ///////phase.monad [iteration! (pattern_matching' statement expression archive pathP)] - (in ($_ _.then - (_.do_while (_.bool false) - iteration!) - (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/case.pattern_matching_error)))))))) + (in (all _.then + (_.do_while (_.bool false) + iteration!) + (_.throw (_.new (_.constant "Exception") (list (_.string ////synthesis/case.pattern_matching_error)))))))) (def: .public dependencies (-> Path (List Var)) @@ -277,10 +277,10 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching statement expression archive pathP)] - (in ($_ _.then - (_.set! @cursor (_.array/* (list stack_init))) - (_.set! @savepoint (_.array/* (list))) - pattern_matching!)))) + (in (all _.then + (_.set! @cursor (_.array/* (list stack_init))) + (_.set! @savepoint (_.array/* (list))) + pattern_matching!)))) (def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index 5e6c9ea30..dfbc53fd3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -51,20 +51,20 @@ (-> (List Expression) Global Var Statement [Statement Expression]) (case inits {.#End} - [($_ _.then - (_.set! @selfL (_.closure (list (_.reference @selfL)) (list) body!)) - (_.set! @selfG @selfL)) + [(all _.then + (_.set! @selfL (_.closure (list (_.reference @selfL)) (list) body!)) + (_.set! @selfG @selfL)) @selfG] _ (let [@inits (|> (list.enumeration inits) (list#each (|>> product.left ..capture)))] [(_.set! @selfG (_.closure (list) (list#each _.parameter @inits) - ($_ _.then - (_.set! @selfL (_.closure (partial_list (_.reference @selfL) (list#each _.reference @inits)) - (list) - body!)) - (_.return @selfL)))) + (all _.then + (_.set! @selfL (_.closure (partial_list (_.reference @selfL) (list#each _.reference @inits)) + (list) + body!)) + (_.return @selfL)))) (_.apply/* inits @selfG)]))) (def: .public (function statement expression archive [environment arity bodyS]) @@ -85,32 +85,32 @@ @selfL (_.var (///reference.artifact function_name)) initialize_self! (_.set! (//case.register 0) @selfL) initialize! (list#mix (.function (_ post pre!) - ($_ _.then - pre! - (_.set! (..input post) (_.item (|> post .int _.int) @curried)))) + (all _.then + pre! + (_.set! (..input post) (_.item (|> post .int _.int) @curried)))) initialize_self! (list.indices arity))] .let [[definition instantiation] (..with_closure closureG+ @selfG @selfL - ($_ _.then - (_.set! @num_args (_.func_num_args/0 [])) - (_.set! @curried (_.func_get_args/0 [])) - (_.cond (list [(|> @num_args (_.=== arityG)) - ($_ _.then - initialize! - (_.set_label @scope) - body!)] - [(|> @num_args (_.> arityG)) - (let [arity_inputs (_.array_slice/3 [@curried (_.int +0) arityG]) - extra_inputs (_.array_slice/2 [@curried arityG]) - next (_.call_user_func_array/2 [@selfL arity_inputs])] - (_.return (_.call_user_func_array/2 [next extra_inputs])))]) - ... (|> @num_args (_.< arityG)) - (let [@missing (_.var "missing")] - (_.return (<| (_.closure (list (_.reference @selfL) (_.reference @curried)) (list)) - ($_ _.then - (_.set! @missing (_.func_get_args/0 [])) - (_.return (_.call_user_func_array/2 [@selfL (_.array_merge/+ @curried (list @missing))]))))))) - ))] + (all _.then + (_.set! @num_args (_.func_num_args/0 [])) + (_.set! @curried (_.func_get_args/0 [])) + (_.cond (list [(|> @num_args (_.=== arityG)) + (all _.then + initialize! + (_.set_label @scope) + body!)] + [(|> @num_args (_.> arityG)) + (let [arity_inputs (_.array_slice/3 [@curried (_.int +0) arityG]) + extra_inputs (_.array_slice/2 [@curried arityG]) + next (_.call_user_func_array/2 [@selfL arity_inputs])] + (_.return (_.call_user_func_array/2 [next extra_inputs])))]) + ... (|> @num_args (_.< arityG)) + (let [@missing (_.var "missing")] + (_.return (<| (_.closure (list (_.reference @selfL) (_.reference @curried)) (list)) + (all _.then + (_.set! @missing (_.func_get_args/0 [])) + (_.return (_.call_user_func_array/2 [@selfL (_.array_merge/+ @curried (list @missing))]))))))) + ))] _ (/////generation.execute! definition) _ (/////generation.save! (product.right function_name) definition)] (in instantiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 1f2d6253c..fb76fdea7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -63,9 +63,9 @@ body! (/////generation.with_anchor [start @scope] (statement expression archive bodyS))] (in (..setup start initsO+ - ($_ _.then - (_.set_label @scope) - body!)))))) + (all _.then + (_.set_label @scope) + body!)))))) (def: .public (scope statement expression archive [start initsS+ bodyS]) (-> Phase! (Generator (Scope Synthesis))) @@ -114,11 +114,11 @@ (do [! ///////phase.monad] [[offset @scope] /////generation.anchor argsO+ (monad.each ! (expression archive) argsS+)] - (in ($_ _.then - (_.set! @temp (_.array/* argsO+)) - (..setup offset - (|> argsO+ - list.enumeration - (list#each (function (_ [idx _]) - (_.item (_.int (.int idx)) @temp)))) - (_.go_to @scope)))))) + (in (all _.then + (_.set! @temp (_.array/* argsO+)) + (..setup offset + (|> argsO+ + list.enumeration + (list#each (function (_ [idx _]) + (_.item (_.int (.int idx)) @temp)))) + (_.go_to @scope)))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index 5baba49fc..dfa7afe2f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -128,22 +128,22 @@ (~ code)))))))))))))))) (runtime: (io//log! message) - ($_ _.then - (_.echo message) - (_.echo (_.string text.new_line)) - (_.return ..unit))) + (all _.then + (_.echo message) + (_.echo (_.string text.new_line)) + (_.return ..unit))) (runtime: (io//throw! message) - ($_ _.then - (_.throw (_.new (_.constant "Exception") (list message))) - (_.return ..unit))) + (all _.then + (_.throw (_.new (_.constant "Exception") (list message))) + (_.return ..unit))) (def: runtime//io Statement - ($_ _.then - @io//log! - @io//throw! - )) + (all _.then + @io//log! + @io//throw! + )) (def: .public tuple_size_field "_lux_size") @@ -161,16 +161,16 @@ (_.return (_.count/1 array)))) (runtime: (array//write idx value array) - ($_ _.then - (_.set! (_.item idx array) value) - (_.return array))) + (all _.then + (_.set! (_.item idx array) value) + (_.return array))) (def: runtime//array Statement - ($_ _.then - @array//length - @array//write - )) + (all _.then + @array//length + @array//write + )) (def: jphp_last_index (|>> ..tuple_size (_.- (_.int +1)))) @@ -178,14 +178,14 @@ (def: normal_last_index (|>> _.count/1 (_.- (_.int +1)))) -(with_expansions [<recur> (these ($_ _.then - (_.set! lefts (_.- last_index_right lefts)) - (_.set! tuple (_.item last_index_right tuple))))] +(with_expansions [<recur> (these (all _.then + (_.set! lefts (_.- last_index_right lefts)) + (_.set! tuple (_.item last_index_right tuple))))] (runtime: (tuple//make size values) (_.if ..jphp? - ($_ _.then - (_.set! (..tuple_size values) size) - (_.return values)) + (all _.then + (_.set! (..tuple_size values) size) + (_.return values)) ... https://www.php.net/manual/en/language.operators.assignment.php ... https://www.php.net/manual/en/language.references.php ... https://www.php.net/manual/en/functions.arguments.php @@ -196,50 +196,50 @@ (runtime: (tuple//left lefts tuple) (with_vars [last_index_right] (<| (_.while (_.bool true)) - ($_ _.then - (_.if ..jphp? - (_.set! last_index_right (..jphp_last_index tuple)) - (_.set! last_index_right (..normal_last_index tuple))) - (_.if (_.> lefts last_index_right) - ... No need for recursion - (_.return (_.item lefts tuple)) - ... Needs recursion - <recur>))))) + (all _.then + (_.if ..jphp? + (_.set! last_index_right (..jphp_last_index tuple)) + (_.set! last_index_right (..normal_last_index tuple))) + (_.if (_.> lefts last_index_right) + ... No need for recursion + (_.return (_.item lefts tuple)) + ... Needs recursion + <recur>))))) ... TODO: Get rid of this as soon as JPHP is no longer necessary. (runtime: (tuple//slice offset input) (with_vars [size index output] - ($_ _.then - (_.set! size (..array//length input)) - (_.set! index (_.int +0)) - (_.set! output (_.array/* (list))) - (<| (_.while (|> index (_.+ offset) (_.< size))) - ($_ _.then - (_.set! (_.item index output) (_.item (_.+ offset index) input)) - (_.set! index (_.+ (_.int +1) index)) - )) - (_.return (..tuple//make (_.- offset size) output)) - ))) + (all _.then + (_.set! size (..array//length input)) + (_.set! index (_.int +0)) + (_.set! output (_.array/* (list))) + (<| (_.while (|> index (_.+ offset) (_.< size))) + (all _.then + (_.set! (_.item index output) (_.item (_.+ offset index) input)) + (_.set! index (_.+ (_.int +1) index)) + )) + (_.return (..tuple//make (_.- offset size) output)) + ))) (runtime: (tuple//right lefts tuple) (with_vars [last_index_right right_index] (<| (_.while (_.bool true)) - ($_ _.then - (_.if ..jphp? - (_.set! last_index_right (..jphp_last_index tuple)) - (_.set! last_index_right (..normal_last_index tuple))) - (_.set! right_index (_.+ (_.int +1) lefts)) - (_.cond (list [(_.=== last_index_right right_index) - (_.return (_.item right_index tuple))] - [(_.> last_index_right right_index) - ... Needs recursion. - <recur>]) - (_.if ..jphp? - (_.return (..tuple//make (_.- right_index (..tuple_size tuple)) - (..tuple//slice right_index tuple))) - (_.return (..tuple//make (_.- right_index (_.count/1 tuple)) - (_.array_slice/2 [(_.do "getArrayCopy" (list) tuple) right_index]))))) - ))))) + (all _.then + (_.if ..jphp? + (_.set! last_index_right (..jphp_last_index tuple)) + (_.set! last_index_right (..normal_last_index tuple))) + (_.set! right_index (_.+ (_.int +1) lefts)) + (_.cond (list [(_.=== last_index_right right_index) + (_.return (_.item right_index tuple))] + [(_.> last_index_right right_index) + ... Needs recursion. + <recur>]) + (_.if ..jphp? + (_.return (..tuple//make (_.- right_index (..tuple_size tuple)) + (..tuple//slice right_index tuple))) + (_.return (..tuple//make (_.- right_index (_.count/1 tuple)) + (_.array_slice/2 [(_.do "getArrayCopy" (list) tuple) right_index]))))) + ))))) (def: .public variant_tag_field "_lux_tag") (def: .public variant_flag_field "_lux_flag") @@ -283,9 +283,9 @@ is_last? (_.=== ..unit sum_flag) test_recursion! (_.if is_last? ... Must recurse. - ($_ _.then - (_.set! wantedTag (_.- sum_tag wantedTag)) - (_.set! sum sum_value)) + (all _.then + (_.set! wantedTag (_.- sum_tag wantedTag)) + (_.set! sum sum_value)) no_match!)] (<| (_.while (_.bool true)) (_.cond (list [(_.=== sum_tag wantedTag) @@ -302,20 +302,20 @@ (def: runtime//adt Statement - ($_ _.then - @tuple//make - @tuple//left - @tuple//slice - @tuple//right - @sum//make - @sum//get - )) + (all _.then + @tuple//make + @tuple//left + @tuple//slice + @tuple//right + @sum//make + @sum//get + )) (runtime: (lux//try op) (with_vars [value] - (_.try ($_ _.then - (_.set! value (_.apply/1 op [..unit])) - (_.return (..right value))) + (_.try (all _.then + (_.set! value (_.apply/1 op [..unit])) + (_.return (..right value))) (list (with_vars [error] [_.#class (_.constant "Exception") _.#exception error @@ -323,18 +323,18 @@ (runtime: (lux//program_args inputs) (with_vars [head tail] - ($_ _.then - (_.set! tail ..none) - (<| (_.for_each (_.array_reverse/1 inputs) head) - (_.set! tail (..some (_.array/* (list head tail))))) - (_.return tail)))) + (all _.then + (_.set! tail ..none) + (<| (_.for_each (_.array_reverse/1 inputs) head) + (_.set! tail (..some (_.array/* (list head tail))))) + (_.return tail)))) (def: runtime//lux Statement - ($_ _.then - @lux//try - @lux//program_args - )) + (all _.then + @lux//try + @lux//program_args + )) (def: .public high (-> (I64 Any) (I64 Any)) @@ -358,13 +358,13 @@ (_.- (_.int +1)) (_.bit_shl (_.int +1)) (_.+ (_.int +1)))] - ($_ _.then - (_.set! param (_.% (_.int +64) param)) - (_.if (_.=== (_.int +0) param) - (_.return subject) - (_.return (|> subject - (_.bit_shr param) - (_.bit_and mask))))))) + (all _.then + (_.set! param (_.% (_.int +64) param)) + (_.if (_.=== (_.int +0) param) + (_.return subject) + (_.return (|> subject + (_.bit_shr param) + (_.bit_and mask))))))) (runtime: (i64//char code) (_.if ..jphp? @@ -389,41 +389,41 @@ (with_vars [l48 l32 l16 l00 r48 r32 r16 r00 x48 x32 x16 x00] - ($_ _.then - (_.set! l48 (hh subject)) - (_.set! l32 (hl subject)) - (_.set! l16 (lh subject)) - (_.set! l00 (ll subject)) - - (_.set! r48 (hh parameter)) - (_.set! r32 (hl parameter)) - (_.set! r16 (lh parameter)) - (_.set! r00 (ll parameter)) - - (_.set! x00 (_.+ l00 r00)) - - (_.set! x16 (|> (high_16 x00) - (_.+ l16) - (_.+ r16))) - (_.set! x00 (low_16 x00)) - - (_.set! x32 (|> (high_16 x16) - (_.+ l32) - (_.+ r32))) - (_.set! x16 (low_16 x16)) - - (_.set! x48 (|> (high_16 x32) - (_.+ l48) - (_.+ r48) - low_16)) - (_.set! x32 (low_16 x32)) - - (let [high32 (_.bit_or (up_16 x48) x32) - low32 (_.bit_or (up_16 x16) x00)] - (_.return (|> high32 - (_.bit_shl (_.int +32)) - (_.bit_or low32)))) - )))) + (all _.then + (_.set! l48 (hh subject)) + (_.set! l32 (hl subject)) + (_.set! l16 (lh subject)) + (_.set! l00 (ll subject)) + + (_.set! r48 (hh parameter)) + (_.set! r32 (hl parameter)) + (_.set! r16 (lh parameter)) + (_.set! r00 (ll parameter)) + + (_.set! x00 (_.+ l00 r00)) + + (_.set! x16 (|> (high_16 x00) + (_.+ l16) + (_.+ r16))) + (_.set! x00 (low_16 x00)) + + (_.set! x32 (|> (high_16 x16) + (_.+ l32) + (_.+ r32))) + (_.set! x16 (low_16 x16)) + + (_.set! x48 (|> (high_16 x32) + (_.+ l48) + (_.+ r48) + low_16)) + (_.set! x32 (low_16 x32)) + + (let [high32 (_.bit_or (up_16 x48) x32) + low32 (_.bit_or (up_16 x16) x00)] + (_.return (|> high32 + (_.bit_shl (_.int +32)) + (_.bit_or low32)))) + )))) (runtime: (i64//negate value) (let [i64//min (_.int (.int (hex "80,00,00,00,00,00,00,00")))] @@ -448,57 +448,57 @@ (with_vars [l48 l32 l16 l00 r48 r32 r16 r00 x48 x32 x16 x00] - ($_ _.then - (_.set! l48 (hh subject)) - (_.set! l32 (hl subject)) - (_.set! l16 (lh subject)) - (_.set! l00 (ll subject)) - - (_.set! r48 (hh parameter)) - (_.set! r32 (hl parameter)) - (_.set! r16 (lh parameter)) - (_.set! r00 (ll parameter)) - - (_.set! x00 (_.* l00 r00)) - (_.set! x16 (high_16 x00)) - (_.set! x00 (low_16 x00)) - - (_.set! x16 (|> x16 (_.+ (_.* l16 r00)))) - (_.set! x32 (high_16 x16)) (_.set! x16 (low_16 x16)) - (_.set! x16 (|> x16 (_.+ (_.* l00 r16)))) - (_.set! x32 (|> x32 (_.+ (high_16 x16)))) (_.set! x16 (low_16 x16)) - - (_.set! x32 (|> x32 (_.+ (_.* l32 r00)))) - (_.set! x48 (high_16 x32)) (_.set! x32 (low_16 x32)) - (_.set! x32 (|> x32 (_.+ (_.* l16 r16)))) - (_.set! x48 (|> x48 (_.+ (high_16 x32)))) (_.set! x32 (low_16 x32)) - (_.set! x32 (|> x32 (_.+ (_.* l00 r32)))) - (_.set! x48 (|> x48 (_.+ (high_16 x32)))) (_.set! x32 (low_16 x32)) - - (_.set! x48 (|> x48 - (_.+ (_.* l48 r00)) - (_.+ (_.* l32 r16)) - (_.+ (_.* l16 r32)) - (_.+ (_.* l00 r48)) - low_16)) - - (let [high32 (_.bit_or (up_16 x48) x32) - low32 (_.bit_or (up_16 x16) x00)] - (_.return (|> high32 - (_.bit_shl (_.int +32)) - (_.bit_or low32)))) - )))) + (all _.then + (_.set! l48 (hh subject)) + (_.set! l32 (hl subject)) + (_.set! l16 (lh subject)) + (_.set! l00 (ll subject)) + + (_.set! r48 (hh parameter)) + (_.set! r32 (hl parameter)) + (_.set! r16 (lh parameter)) + (_.set! r00 (ll parameter)) + + (_.set! x00 (_.* l00 r00)) + (_.set! x16 (high_16 x00)) + (_.set! x00 (low_16 x00)) + + (_.set! x16 (|> x16 (_.+ (_.* l16 r00)))) + (_.set! x32 (high_16 x16)) (_.set! x16 (low_16 x16)) + (_.set! x16 (|> x16 (_.+ (_.* l00 r16)))) + (_.set! x32 (|> x32 (_.+ (high_16 x16)))) (_.set! x16 (low_16 x16)) + + (_.set! x32 (|> x32 (_.+ (_.* l32 r00)))) + (_.set! x48 (high_16 x32)) (_.set! x32 (low_16 x32)) + (_.set! x32 (|> x32 (_.+ (_.* l16 r16)))) + (_.set! x48 (|> x48 (_.+ (high_16 x32)))) (_.set! x32 (low_16 x32)) + (_.set! x32 (|> x32 (_.+ (_.* l00 r32)))) + (_.set! x48 (|> x48 (_.+ (high_16 x32)))) (_.set! x32 (low_16 x32)) + + (_.set! x48 (|> x48 + (_.+ (_.* l48 r00)) + (_.+ (_.* l32 r16)) + (_.+ (_.* l16 r32)) + (_.+ (_.* l00 r48)) + low_16)) + + (let [high32 (_.bit_or (up_16 x48) x32) + low32 (_.bit_or (up_16 x16) x00)] + (_.return (|> high32 + (_.bit_shl (_.int +32)) + (_.bit_or low32)))) + )))) (def: runtime//i64 Statement - ($_ _.then - @i64//right_shifted - @i64//char - @i64//+ - @i64//negate - @i64//- - @i64//* - )) + (all _.then + @i64//right_shifted + @i64//char + @i64//+ + @i64//negate + @i64//- + @i64//* + )) (runtime: (text//size value) (_.if ..jphp? @@ -510,16 +510,16 @@ (_.return (..some (_.int +0))) (with_vars [idx] (_.if ..jphp? - ($_ _.then - (_.set! idx (_.strpos/3 [subject param start])) - (_.if (_.=== (_.bool false) idx) - (_.return ..none) - (_.return (..some idx)))) - ($_ _.then - (_.set! idx (_.iconv_strpos/3 [subject param start])) - (_.if (_.=== (_.bool false) idx) - (_.return ..none) - (_.return (..some idx)))))))) + (all _.then + (_.set! idx (_.strpos/3 [subject param start])) + (_.if (_.=== (_.bool false) idx) + (_.return ..none) + (_.return (..some idx)))) + (all _.then + (_.set! idx (_.iconv_strpos/3 [subject param start])) + (_.if (_.=== (_.bool false) idx) + (_.return ..none) + (_.return (..some idx)))))))) (def: (within? top value) (-> Expression Expression Computation) @@ -545,35 +545,35 @@ (def: runtime//text Statement - ($_ _.then - @text//size - @text//index - @text//clip - @text//char - )) + (all _.then + @text//size + @text//index + @text//clip + @text//char + )) (runtime: (f64//decode value) (with_vars [output] - ($_ _.then - (_.set! output (_.floatval/1 value)) - (_.if (_.=== (_.float +0.0) output) - (_.if ($_ _.or - (_.=== (_.string "0.0") output) - (_.=== (_.string "+0.0") output) - (_.=== (_.string "-0.0") output) - (_.=== (_.string "0") output) - (_.=== (_.string "+0") output) - (_.=== (_.string "-0") output)) - (_.return (..some output)) - (_.return ..none)) - (_.return (..some output))) - ))) + (all _.then + (_.set! output (_.floatval/1 value)) + (_.if (_.=== (_.float +0.0) output) + (_.if (all _.or + (_.=== (_.string "0.0") output) + (_.=== (_.string "+0.0") output) + (_.=== (_.string "-0.0") output) + (_.=== (_.string "0") output) + (_.=== (_.string "+0") output) + (_.=== (_.string "-0") output)) + (_.return (..some output)) + (_.return ..none)) + (_.return (..some output))) + ))) (def: runtime//f64 Statement - ($_ _.then - @f64//decode - )) + (all _.then + @f64//decode + )) (def: check_necessary_conditions! Statement @@ -585,16 +585,16 @@ (def: runtime Statement - ($_ _.then - check_necessary_conditions! - runtime//array - runtime//adt - runtime//lux - runtime//i64 - runtime//f64 - runtime//text - runtime//io - )) + (all _.then + check_necessary_conditions! + runtime//array + runtime//adt + runtime//lux + runtime//i64 + runtime//f64 + runtime//text + runtime//io + )) (def: .public generate (Operation [Registry Output]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index aed266e9f..0479e132e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -69,9 +69,9 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (in ($_ _.then - (_.set (list (..register register)) valueO) - bodyO)))) + (in (all _.then + (_.set (list (..register register)) valueO) + bodyO)))) (def: .public (exec expression archive [pre post]) (Generator [Synthesis Synthesis]) @@ -85,9 +85,9 @@ (do ///////phase.monad [pre (expression archive pre) post (statement expression archive post)] - (in ($_ _.then - (_.statement pre) - post)))) + (in (all _.then + (_.statement pre) + post)))) (def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -158,16 +158,16 @@ (template [<name> <flag>] [(def: (<name> simple? idx) (-> Bit Nat (Statement Any)) - ($_ _.then - (_.set (list @temp) (//runtime.sum::get ..peek <flag> - (|> idx .int _.int))) - (.if simple? - (_.when (_.= _.none @temp) - fail_pm!) - (_.if (_.= _.none @temp) - fail_pm! - (..push! @temp)) - )))] + (all _.then + (_.set (list @temp) (//runtime.sum::get ..peek <flag> + (|> idx .int _.int))) + (.if simple? + (_.when (_.= _.none @temp) + fail_pm!) + (_.if (_.= _.none @temp) + fail_pm! + (..push! @temp)) + )))] [left_choice _.none] [right_choice //runtime.unit] @@ -179,23 +179,23 @@ (_.while (_.bool true) body! {.#None}) - ($_ _.then - (_.set (list g!once) (_.bool true)) - (_.while g!once - ($_ _.then - (_.set (list g!once) (_.bool false)) - body!) - {.#Some _.continue})))) + (all _.then + (_.set (list g!once) (_.bool true)) + (_.while g!once + (all _.then + (_.set (list g!once) (_.bool false)) + body!) + {.#Some _.continue})))) (def: (alternation in_closure? g!once pre! post!) (-> Bit SVar (Statement Any) (Statement Any) (Statement Any)) - ($_ _.then - (..with_looping in_closure? g!once - ($_ _.then - ..save! - pre!)) - ..restore! - post!)) + (all _.then + (..with_looping in_closure? g!once + (all _.then + ..save! + pre!)) + ..restore! + post!)) (def: (primitive_pattern_matching again pathP) (-> (-> Path (Operation (Statement Any))) @@ -281,17 +281,17 @@ (pattern (/////synthesis.!bind_top register thenP)) (do ! [then! (again thenP)] - (///////phase#in ($_ _.then - (_.set (list (..register register)) ..peek_and_pop) - then!))) + (///////phase#in (all _.then + (_.set (list (..register register)) ..peek_and_pop) + then!))) (pattern (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (case.count_pops nextP)] (do ! [next! (again nextP')] - (///////phase#in ($_ _.then - (..multi_pop! (n.+ 2 extra_pops)) - next!)))) + (///////phase#in (all _.then + (..multi_pop! (n.+ 2 extra_pops)) + next!)))) (pattern (/////synthesis.path/seq preP postP)) (do ! @@ -314,10 +314,10 @@ (do ///////phase.monad [pattern_matching! (pattern_matching' in_closure? statement expression archive pathP) g!once (..symbol "once")] - (in ($_ _.then - (..with_looping in_closure? g!once - pattern_matching!) - (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))) + (in (all _.then + (..with_looping in_closure? g!once + pattern_matching!) + (_.raise (_.Exception/1 (_.string case.pattern_matching_error))))))) (def: .public dependencies (-> Path (List SVar)) @@ -337,11 +337,11 @@ (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching in_closure? statement expression archive pathP)] - (in ($_ _.then - (_.set (list @cursor) (_.list (list stack_init))) - (_.set (list @savepoint) (_.list (list))) - pattern_matching! - )))) + (in (all _.then + (_.set (list @cursor) (_.list (list stack_init))) + (_.set (list @savepoint) (_.list (list))) + pattern_matching! + )))) (def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index efbefac6b..077cdf100 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -59,9 +59,9 @@ [.let [directive (_.def @function (|> (list.enumeration inits) (list#each (|>> product.left ..capture))) - ($_ _.then - function_definition - (_.return @function)))] + (all _.then + function_definition + (_.return @function)))] _ (/////generation.execute! directive) _ (/////generation.save! function_id {.#None} directive)] (in (_.apply/* inits @function))))) @@ -85,32 +85,32 @@ (_.apply/* (list (_.splat_poly args)) func)) initialize_self! (_.set (list (//case.register 0)) @self) initialize! (list#mix (.function (_ post pre!) - ($_ _.then - pre! - (_.set (list (..input post)) (_.item (|> post .int _.int) @curried)))) + (all _.then + pre! + (_.set (list (..input post)) (_.item (|> post .int _.int) @curried)))) initialize_self! (list.indices arity))]] (with_closure function_artifact @self environment (_.def @self (list (_.poly @curried)) - ($_ _.then - (_.set (list @num_args) (_.len/1 @curried)) - (<| (_.if (|> @num_args (_.= arityO)) - (<| (_.then initialize!) - //loop.set_scope - body!)) - (_.if (|> @num_args (_.> arityO)) - (let [arity_inputs (_.slice (_.int +0) arityO @curried) - extra_inputs (_.slice arityO @num_args @curried)] - (_.return (|> @self - (apply_poly arity_inputs) - (apply_poly extra_inputs))))) - ... (|> @num_args (_.< arityO)) - (let [@next (_.var "next") - @missing (_.var "missing")] - ($_ _.then - (_.def @next (list (_.poly @missing)) - (_.return (|> @self (apply_poly (|> @curried (_.+ @missing)))))) - (_.return @next) - ))) - ))) + (all _.then + (_.set (list @num_args) (_.len/1 @curried)) + (<| (_.if (|> @num_args (_.= arityO)) + (<| (_.then initialize!) + //loop.set_scope + body!)) + (_.if (|> @num_args (_.> arityO)) + (let [arity_inputs (_.slice (_.int +0) arityO @curried) + extra_inputs (_.slice arityO @num_args @curried)] + (_.return (|> @self + (apply_poly arity_inputs) + (apply_poly extra_inputs))))) + ... (|> @num_args (_.< arityO)) + (let [@next (_.var "next") + @missing (_.var "missing")] + (all _.then + (_.def @next (list (_.poly @missing)) + (_.return (|> @self (apply_poly (|> @curried (_.+ @missing)))))) + (_.return @next) + ))) + ))) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 5c6d545f1..951fcbb18 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -40,9 +40,9 @@ (let [variables (|> bindings list.enumeration (list#each (|>> product.left (n.+ offset) //case.register)))] - ($_ _.then - (_.set variables (_.multi bindings)) - body))) + (all _.then + (_.set variables (_.multi bindings)) + body))) (def: .public (set_scope body!) (-> (Statement Any) (Statement Any)) @@ -101,10 +101,10 @@ foreigns [(_.def @loop foreigns - ($_ _.then - actual_loop - (_.return @loop) - )) + (all _.then + actual_loop + (_.return @loop) + )) (_.apply/* foreigns @loop)]))] _ (/////generation.execute! directive) _ (/////generation.save! loop_artifact {.#None} directive)] @@ -120,7 +120,7 @@ list.enumeration (list#each (function (_ [idx _]) (_.item (_.int (.int idx)) @temp))))]] - (in ($_ _.then - (_.set (list @temp) (_.list argsO+)) - (..setup offset re_binds - _.continue))))) + (in (all _.then + (_.set (list @temp) (_.list argsO+)) + (..setup offset re_binds + _.continue))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 525b2a108..1dd017309 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -165,75 +165,75 @@ (runtime: (lux::program_args program_args) (with_vars [inputs value] - ($_ _.then - (_.set (list inputs) ..none) - (<| (_.for_in value (_.apply/* (list program_args) (_.var "reversed"))) - (_.set (list inputs) - (..some (_.list (list value inputs))))) - (_.return inputs)))) + (all _.then + (_.set (list inputs) ..none) + (<| (_.for_in value (_.apply/* (list program_args) (_.var "reversed"))) + (_.set (list inputs) + (..some (_.list (list value inputs))))) + (_.return inputs)))) (runtime: (lux::exec code globals) - ($_ _.then - (_.exec {.#Some globals} code) - (_.return ..unit))) + (all _.then + (_.exec {.#Some globals} code) + (_.return ..unit))) (def: runtime::lux (Statement Any) - ($_ _.then - @lux::try - @lux::program_args - @lux::exec - )) + (all _.then + @lux::try + @lux::program_args + @lux::exec + )) (runtime: (io::log! message) - ($_ _.then - (_.print message) - (|> (_.__import__/1 (_.unicode "sys")) - (_.the "stdout") - (_.do "flush" (list)) - _.statement) - (_.return ..unit))) + (all _.then + (_.print message) + (|> (_.__import__/1 (_.unicode "sys")) + (_.the "stdout") + (_.do "flush" (list)) + _.statement) + (_.return ..unit))) (runtime: (io::throw! message) (_.raise (_.Exception/1 message))) (def: runtime::io (Statement Any) - ($_ _.then - @io::log! - @io::throw! - )) + (all _.then + @io::log! + @io::throw! + )) (def: last_index (|>> _.len/1 (_.- (_.int +1)))) -(with_expansions [<recur> (these ($_ _.then - (_.set (list lefts) (_.- last_index_right lefts)) - (_.set (list tuple) (_.item last_index_right tuple))))] +(with_expansions [<recur> (these (all _.then + (_.set (list lefts) (_.- last_index_right lefts)) + (_.set (list tuple) (_.item last_index_right tuple))))] (runtime: (tuple::left lefts tuple) (with_vars [last_index_right] (_.while (_.bool true) - ($_ _.then - (_.set (list last_index_right) (..last_index tuple)) - (_.if (_.> lefts last_index_right) - ... No need for recursion - (_.return (_.item lefts tuple)) - ... Needs recursion - <recur>)) + (all _.then + (_.set (list last_index_right) (..last_index tuple)) + (_.if (_.> lefts last_index_right) + ... No need for recursion + (_.return (_.item lefts tuple)) + ... Needs recursion + <recur>)) {.#None}))) (runtime: (tuple::right lefts tuple) (with_vars [last_index_right right_index] (_.while (_.bool true) - ($_ _.then - (_.set (list last_index_right) (..last_index tuple)) - (_.set (list right_index) (_.+ (_.int +1) lefts)) - (<| (_.if (_.= last_index_right right_index) - (_.return (_.item right_index tuple))) - (_.if (_.> last_index_right right_index) - ... Needs recursion. - <recur>) - (_.return (_.slice_from right_index tuple)))) + (all _.then + (_.set (list last_index_right) (..last_index tuple)) + (_.set (list right_index) (_.+ (_.int +1) lefts)) + (<| (_.if (_.= last_index_right right_index) + (_.return (_.item right_index tuple))) + (_.if (_.> last_index_right right_index) + ... Needs recursion. + <recur>) + (_.return (_.slice_from right_index tuple)))) {.#None})))) (runtime: (sum::get sum expected##right? expected##lefts) @@ -241,11 +241,11 @@ actual##lefts (_.item (_.int +0) sum) actual##right? (_.item (_.int +1) sum) actual##value (_.item (_.int +2) sum) - recur! ($_ _.then - (_.set (list expected##lefts) (|> expected##lefts - (_.- actual##lefts) - (_.- (_.int +1)))) - (_.set (list sum) actual##value))] + recur! (all _.then + (_.set (list expected##lefts) (|> expected##lefts + (_.- actual##lefts) + (_.- (_.int +1)))) + (_.set (list sum) actual##value))] (_.while (_.bool true) (<| (_.if (_.= expected##lefts actual##lefts) (_.if (_.= expected##right? actual##right?) @@ -266,11 +266,11 @@ (def: runtime::adt (Statement Any) - ($_ _.then - @tuple::left - @tuple::right - @sum::get - )) + (all _.then + @tuple::left + @tuple::right + @sum::get + )) (def: i64::+limit (_.manual "+0x7FFFFFFFFFFFFFFF")) (def: i64::-limit (_.manual "-0x8000000000000000")) @@ -283,11 +283,11 @@ (with_vars [temp] (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>] [(_.if (|> input <scenario>) - ($_ _.then - (_.set (list temp) (_.% <iteration> input)) - (_.return (_.? (|> temp <scenario>) - (|> temp (_.- <cap>) (_.+ <entrance>)) - temp))))] + (all _.then + (_.set (list temp) (_.% <iteration> input)) + (_.return (_.? (|> temp <scenario>) + (|> temp (_.- <cap>) (_.+ <entrance>)) + temp))))] [(_.> ..i64::+limit) ..i64::+iteration ..i64::+cap ..i64::-limit] [(_.< ..i64::-limit) ..i64::-iteration ..i64::-cap ..i64::+limit] @@ -305,30 +305,30 @@ ..i64::64))) (runtime: (i64::right_shifted param subject) - ($_ _.then - (_.set (list param) (_.% (_.int +64) param)) - (_.return (_.? (_.= (_.int +0) param) - subject - (|> subject - ..as_nat - (_.bit_shr param)))))) + (all _.then + (_.set (list param) (_.% (_.int +64) param)) + (_.return (_.? (_.= (_.int +0) param) + subject + (|> subject + ..as_nat + (_.bit_shr param)))))) (runtime: (i64#/ param subject) (with_vars [floored] - ($_ _.then - (_.set (list floored) (_.// param subject)) - (_.return (let [potentially_floored? (_.< (_.int +0) floored) - inexact? (|> subject - (_.% param) - (_.= (_.int +0)) - _.not)] - (<| (_.? (_.and potentially_floored? - inexact?) - (_.+ (_.int +1) floored)) - (_.? (_.= (_.manual "+9223372036854775808") - floored) - (_.manual "-9223372036854775808")) - floored)))))) + (all _.then + (_.set (list floored) (_.// param subject)) + (_.return (let [potentially_floored? (_.< (_.int +0) floored) + inexact? (|> subject + (_.% param) + (_.= (_.int +0)) + _.not)] + (<| (_.? (_.and potentially_floored? + inexact?) + (_.+ (_.int +1) floored)) + (_.? (_.= (_.manual "+9223372036854775808") + floored) + (_.manual "-9223372036854775808")) + floored)))))) (runtime: (i64::remainder param subject) (_.return (_.- (|> subject (..i64#/ param) (_.* param)) @@ -356,17 +356,17 @@ (def: runtime::i64 (Statement Any) - ($_ _.then - @i64::64 - @i64::left_shifted - @i64::right_shifted - @i64#/ - @i64::remainder - @i64::and - @i64::or - @i64::xor - @i64::char - )) + (all _.then + @i64::64 + @i64::left_shifted + @i64::right_shifted + @i64#/ + @i64::remainder + @i64::and + @i64::or + @i64::xor + @i64::char + )) (runtime: (f64::/ parameter subject) (_.return (_.? (_.= (_.float +0.0) parameter) @@ -385,18 +385,18 @@ (def: runtime::f64 (Statement Any) - ($_ _.then - @f64::/ - @f64::decode - )) + (all _.then + @f64::/ + @f64::decode + )) (runtime: (text::index start param subject) (with_vars [idx] - ($_ _.then - (_.set (list idx) (|> subject (_.do "find" (list param start)))) - (_.return (_.? (_.= (_.int -1) idx) - ..none - (..some (..i64::64 idx))))))) + (all _.then + (_.set (list idx) (|> subject (_.do "find" (list param start)))) + (_.return (_.? (_.= (_.int -1) idx) + ..none + (..some (..i64::64 idx))))))) (def: ++ (|>> (_.+ (_.int +1)))) @@ -416,34 +416,34 @@ (def: runtime::text (Statement Any) - ($_ _.then - @text::index - @text::clip - @text::char - )) + (all _.then + @text::index + @text::clip + @text::char + )) (runtime: (array::write idx value array) - ($_ _.then - (_.set (list (_.item idx array)) value) - (_.return array))) + (all _.then + (_.set (list (_.item idx array)) value) + (_.return array))) (def: runtime::array (Statement Any) - ($_ _.then - @array::write - )) + (all _.then + @array::write + )) (def: runtime (Statement Any) - ($_ _.then - runtime::lux - runtime::io - runtime::adt - runtime::i64 - runtime::f64 - runtime::text - runtime::array - )) + (all _.then + runtime::lux + runtime::io + runtime::adt + runtime::i64 + runtime::f64 + runtime::text + runtime::array + )) (def: module_id 0) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index d75170250..21e45438d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -51,9 +51,9 @@ [valueO (expression archive valueS) bodyO (expression archive bodyS)] (in (_.block - ($_ _.then - (_.set! (..register register) valueO) - bodyO))))) + (all _.then + (_.set! (..register register) valueO) + bodyO))))) (def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -182,11 +182,11 @@ (^.template [<pm> <flag> <prep>] [(pattern (<pm> idx)) - (///////phase#in ($_ _.then - (_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>)))) - (_.if (_.= _.null $temp) - ..fail! - (..push_cursor! $temp))))]) + (///////phase#in (all _.then + (_.set! $temp (|> idx <prep> .int _.int (//runtime.sum::get ..peek (//runtime.flag <flag>)))) + (_.if (_.= _.null $temp) + ..fail! + (..push_cursor! $temp))))]) ([/////synthesis.side/left false (<|)] [/////synthesis.side/right true ++]) @@ -203,21 +203,21 @@ (do ///////phase.monad [leftO (again leftP) rightO (again rightP)] - (in ($_ _.then - leftO - rightO))) + (in (all _.then + leftO + rightO))) (pattern (/////synthesis.path/alt leftP rightP)) (do [! ///////phase.monad] [leftO (again leftP) rightO (again rightP)] - (in (_.try ($_ _.then - ..save_cursor! - leftO) + (in (_.try (all _.then + ..save_cursor! + leftO) {.#None} - {.#Some (..catch ($_ _.then - ..restore_cursor! - rightO))} + {.#Some (..catch (all _.then + ..restore_cursor! + rightO))} {.#None}))) ))) @@ -234,8 +234,8 @@ (Generator [Synthesis Path]) (do [! ///////phase.monad] [valueO (expression archive valueS)] - (<| (# ! each (|>> ($_ _.then - (_.set! $cursor (_.list (list valueO))) - (_.set! $savepoint (_.list (list)))) + (<| (# ! each (|>> (all _.then + (_.set! $cursor (_.list (list valueO))) + (_.set! $savepoint (_.list (list)))) _.block)) (pattern_matching expression archive pathP)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux index 37818bd6f..11a7de8ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux @@ -1,36 +1,36 @@ (.using - [library - [lux {"-" function} - [abstract - ["[0]" monad {"+" do}]] - [control - pipe] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [target - ["_" r {"+" Expression SVar}]]]] - ["[0]" // "_" - ["[1][0]" runtime {"+" Operation Phase Generator}] + [library + [lux {"-" function} + [abstract + ["[0]" monad {"+" do}]] + [control + pipe] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [target + ["_" r {"+" Expression SVar}]]]] + ["[0]" // "_" + ["[1][0]" runtime {"+" Operation Phase Generator}] + ["[1][0]" reference] + ["[1][0]" case] + ["/[1]" // "_" ["[1][0]" reference] - ["[1][0]" case] - ["/[1]" // "_" - ["[1][0]" reference] + ["//[1]" /// "_" + [analysis {"+" Variant Tuple Abstraction Application Analysis}] + [synthesis {"+" Synthesis}] + ["[1][0]" generation {"+" Context}] ["//[1]" /// "_" - [analysis {"+" Variant Tuple Abstraction Application Analysis}] - [synthesis {"+" Synthesis}] - ["[1][0]" generation {"+" Context}] - ["//[1]" /// "_" - [arity {"+" Arity}] - ["[1][0]" phase ("[1]#[0]" monad)] - [reference - [variable {"+" Register Variable}]] - [meta - [archive - ["[0]" artifact]]]]]]]) + [arity {"+" Arity}] + ["[1][0]" phase ("[1]#[0]" monad)] + [reference + [variable {"+" Register Variable}]] + [meta + [archive + ["[0]" artifact]]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -56,9 +56,9 @@ list.size list.indices (list#each //case.capture)) - ($_ _.then - function_definition - $function)))] + (all _.then + function_definition + $function)))] _ (/////generation.execute! closure_definition) _ (/////generation.save! (%.nat function_id) closure_definition)] (in (_.apply inits $function))))) @@ -88,30 +88,30 @@ (_.apply (list func args) (_.var "do.call")))]] (with_closure function_artifact $self closureO+ (_.set! $self (_.function (list _.var_args) - ($_ _.then - (_.set! $curried (_.list (list _.var_args))) - (_.set! $num_args (_.length $curried)) - (_.cond (list [(|> $num_args (_.= arityO)) - ($_ _.then - (_.set! (//case.register 0) $self) - (|> arity - list.indices - (list#each input_declaration) - (list#mix _.then bodyO)))] - [(|> $num_args (_.> arityO)) - (let [arity_args (_.slice (_.int +1) arityO $curried) - output_func_args (_.slice (|> arityO (_.+ (_.int +1))) - $num_args - $curried)] - (|> $self - (apply_poly arity_args) - (apply_poly output_func_args)))]) - ... (|> $num_args (_.< arityO)) - (let [$missing (_.var "missing")] - (_.function (list _.var_args) - ($_ _.then - (_.set! $missing (_.list (list _.var_args))) - (|> $self - (apply_poly (_.apply (list $curried $missing) - (_.var "append")))))))))))) + (all _.then + (_.set! $curried (_.list (list _.var_args))) + (_.set! $num_args (_.length $curried)) + (_.cond (list [(|> $num_args (_.= arityO)) + (all _.then + (_.set! (//case.register 0) $self) + (|> arity + list.indices + (list#each input_declaration) + (list#mix _.then bodyO)))] + [(|> $num_args (_.> arityO)) + (let [arity_args (_.slice (_.int +1) arityO $curried) + output_func_args (_.slice (|> arityO (_.+ (_.int +1))) + $num_args + $curried)] + (|> $self + (apply_poly arity_args) + (apply_poly output_func_args)))]) + ... (|> $num_args (_.< arityO)) + (let [$missing (_.var "missing")] + (_.function (list _.var_args) + (all _.then + (_.set! $missing (_.list (list _.var_args))) + (|> $self + (apply_poly (_.apply (list $curried $missing) + (_.var "append")))))))))))) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux index 860d68839..192386b79 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux @@ -1,37 +1,37 @@ (.using - [library - [lux {"-" Scope} - [abstract - ["[0]" monad {"+" do}]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)] - ["[0]" set {"+" Set}]]] - [math - [number - ["n" nat]]] - [target - ["_" r]]]] - ["[0]" // "_" - [runtime {"+" Operation Phase Generator}] - ["[1][0]" case] + [library + [lux {"-" Scope} + [abstract + ["[0]" monad {"+" do}]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)] + ["[0]" set {"+" Set}]]] + [math + [number + ["n" nat]]] + [target + ["_" r]]]] + ["[0]" // "_" + [runtime {"+" Operation Phase Generator}] + ["[1][0]" case] + ["/[1]" // "_" + ["[1][0]" reference] ["/[1]" // "_" - ["[1][0]" reference] + [synthesis + ["[0]" case]] ["/[1]" // "_" - [synthesis - ["[0]" case]] - ["/[1]" // "_" - ["[0]"synthesis {"+" Scope Synthesis}] - ["[1][0]" generation] - ["//[1]" /// "_" - ["[1][0]" phase] - [meta - [archive {"+" Archive}]] - [reference - [variable {"+" Register}]]]]]]]) + ["[0]"synthesis {"+" Scope Synthesis}] + ["[1][0]" generation] + ["//[1]" /// "_" + ["[1][0]" phase] + [meta + [archive {"+" Archive}]] + [reference + [variable {"+" Register}]]]]]]]) (def: .public (scope expression archive [offset initsS+ bodyS]) (Generator (Scope Synthesis)) @@ -48,14 +48,14 @@ bodyO (/////generation.with_anchor $scope (expression archive bodyS))] (in (_.block - ($_ _.then - (_.set! $scope - (_.function (|> initsS+ - list.size - list.indices - (list#each (|>> (n.+ offset) //case.register))) - bodyO)) - (_.apply initsO+ $scope))))))) + (all _.then + (_.set! $scope + (_.function (|> initsS+ + list.size + list.indices + (list#each (|>> (n.+ offset) //case.register))) + bodyO)) + (_.apply initsO+ $scope))))))) (def: .public (again expression archive argsS+) (Generator (List Synthesis)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index ecde6abbd..9993054a4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -125,7 +125,7 @@ (-> Text Proc) (function (_ proc_name) (function (_ translate inputsS) - (case (s.result inputsS ($_ p.and s.nat (s.tuple (p.many s.any)) s.any)) + (case (s.result inputsS (all p.and s.nat (s.tuple (p.many s.any)) s.any)) {e.#Success [offset initsS+ bodyS]} (loopT.translate_loop translate offset initsS+ bodyS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index c6ff7f292..acb12a286 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -179,11 +179,11 @@ (runtime: (i64::unsigned_low input) (with_vars [low] - ($_ _.then - (_.set! low (_.item (_.string ..i64_low_field) input)) - (_.if (_.< (_.int +0) low) - (_.+ f2^32 low) - low)))) + (all _.then + (_.set! low (_.item (_.string ..i64_low_field) input)) + (_.if (_.< (_.int +0) low) + (_.+ f2^32 low) + low)))) (runtime: (i64::float input) (let [high (|> input @@ -237,34 +237,34 @@ (runtime: (i64::+ param subject) (with_vars [sH sL pH pL x00 x16 x32 x48] - ($_ _.then - (_.set! sH (|> subject i64_high)) - (_.set! sL (|> subject i64_low)) - (_.set! pH (|> param i64_high)) - (_.set! pL (|> param i64_low)) - (let [bits16 (_.manual "0xFFFF") - move_top_16 (_.bit_shl (_.int +16)) - top_16 (_.bit_ushr (_.int +16)) - bottom_16 (_.bit_and bits16) - split_16 (function (_ source) - [(|> source top_16) - (|> source bottom_16)]) - split_int (function (_ high low) - [(split_16 high) - (split_16 low)]) - - [[s48 s32] [s16 s00]] (split_int sH sL) - [[p48 p32] [p16 p00]] (split_int pH pL) - new_half (function (_ top bottom) - (|> top bottom_16 move_top_16 - (_.bit_or (bottom_16 bottom))))] - ($_ _.then - (_.set! x00 (|> s00 (_.+ p00))) - (_.set! x16 (|> x00 top_16 (_.+ s16) (_.+ p16))) - (_.set! x32 (|> x16 top_16 (_.+ s32) (_.+ p32))) - (_.set! x48 (|> x32 top_16 (_.+ s48) (_.+ p48))) - (i64::new (new_half x48 x32) - (new_half x16 x00))))))) + (all _.then + (_.set! sH (|> subject i64_high)) + (_.set! sL (|> subject i64_low)) + (_.set! pH (|> param i64_high)) + (_.set! pL (|> param i64_low)) + (let [bits16 (_.manual "0xFFFF") + move_top_16 (_.bit_shl (_.int +16)) + top_16 (_.bit_ushr (_.int +16)) + bottom_16 (_.bit_and bits16) + split_16 (function (_ source) + [(|> source top_16) + (|> source bottom_16)]) + split_int (function (_ high low) + [(split_16 high) + (split_16 low)]) + + [[s48 s32] [s16 s00]] (split_int sH sL) + [[p48 p32] [p16 p00]] (split_int pH pL) + new_half (function (_ top bottom) + (|> top bottom_16 move_top_16 + (_.bit_or (bottom_16 bottom))))] + (all _.then + (_.set! x00 (|> s00 (_.+ p00))) + (_.set! x16 (|> x00 top_16 (_.+ s16) (_.+ p16))) + (_.set! x32 (|> x16 top_16 (_.+ s32) (_.+ p32))) + (_.set! x48 (|> x32 top_16 (_.+ s48) (_.+ p48))) + (i64::new (new_half x48 x32) + (new_half x16 x00))))))) (runtime: (i64::= reference sample) (let [n/a? (function (_ value) @@ -293,15 +293,15 @@ (runtime: (i64::< reference sample) (with_vars [r_? s_?] - ($_ _.then - (_.set! s_? (|> sample ..i64_high (_.< (_.int +0)))) - (_.set! r_? (|> reference ..i64_high (_.< (_.int +0)))) - (|> (|> s_? (_.and (_.not r_?))) - (_.or (|> (_.not s_?) (_.and r_?) _.not)) - (_.or (|> sample - (i64::- reference) - ..i64_high - (_.< (_.int +0)))))))) + (all _.then + (_.set! s_? (|> sample ..i64_high (_.< (_.int +0)))) + (_.set! r_? (|> reference ..i64_high (_.< (_.int +0)))) + (|> (|> s_? (_.and (_.not r_?))) + (_.or (|> (_.not s_?) (_.and r_?) _.not)) + (_.or (|> sample + (i64::- reference) + ..i64_high + (_.< (_.int +0)))))))) (runtime: (i64::of_float input) (_.cond (list [(_.apply (list input) (_.var "is.nan")) @@ -318,65 +318,65 @@ (runtime: (i64::* param subject) (with_vars [sH sL pH pL x00 x16 x32 x48] - ($_ _.then - (_.set! sH (|> subject i64_high)) - (_.set! pH (|> param i64_high)) - (let [negative_subject? (|> sH (_.< (_.int +0))) - negative_param? (|> pH (_.< (_.int +0)))] - (_.cond (list [negative_subject? - (_.if negative_param? - (i64::* (i64::opposite param) - (i64::opposite subject)) - (i64::opposite (i64::* param - (i64::opposite subject))))] - - [negative_param? - (i64::opposite (i64::* (i64::opposite param) - subject))]) - ($_ _.then - (_.set! sL (|> subject i64_low)) - (_.set! pL (|> param i64_low)) - (let [bits16 (_.manual "0xFFFF") - move_top_16 (_.bit_shl (_.int +16)) - top_16 (_.bit_ushr (_.int +16)) - bottom_16 (_.bit_and bits16) - split_16 (function (_ source) - [(|> source top_16) - (|> source bottom_16)]) - split_int (function (_ high low) - [(split_16 high) - (split_16 low)]) - new_half (function (_ top bottom) - (|> top bottom_16 move_top_16 - (_.bit_or (bottom_16 bottom)))) - x16_top (|> x16 top_16) - x32_top (|> x32 top_16)] - (with_vars [s48 s32 s16 s00 - p48 p32 p16 p00] - (let [[[_s48 _s32] [_s16 _s00]] (split_int sH sL) - [[_p48 _p32] [_p16 _p00]] (split_int pH pL) - set_subject_chunks! ($_ _.then (_.set! s48 _s48) (_.set! s32 _s32) (_.set! s16 _s16) (_.set! s00 _s00)) - set_param_chunks! ($_ _.then (_.set! p48 _p48) (_.set! p32 _p32) (_.set! p16 _p16) (_.set! p00 _p00))] - ($_ _.then - set_subject_chunks! - set_param_chunks! - (_.set! x00 (|> s00 (_.* p00))) - (_.set! x16 (|> x00 top_16 (_.+ (|> s16 (_.* p00))))) - (_.set! x32 x16_top) - (_.set! x16 (|> x16 bottom_16 (_.+ (|> s00 (_.* p16))))) - (_.set! x32 (|> x32 (_.+ x16_top) (_.+ (|> s32 (_.* p00))))) - (_.set! x48 x32_top) - (_.set! x32 (|> x32 bottom_16 (_.+ (|> s16 (_.* p16))))) - (_.set! x48 (|> x48 (_.+ x32_top))) - (_.set! x32 (|> x32 bottom_16 (_.+ (|> s00 (_.* p32))))) - (_.set! x48 (|> x48 (_.+ x32_top) - (_.+ (|> s48 (_.* p00))) - (_.+ (|> s32 (_.* p16))) - (_.+ (|> s16 (_.* p32))) - (_.+ (|> s00 (_.* p48))))) - (i64::new (new_half x48 x32) - (new_half x16 x00))))) - ))))))) + (all _.then + (_.set! sH (|> subject i64_high)) + (_.set! pH (|> param i64_high)) + (let [negative_subject? (|> sH (_.< (_.int +0))) + negative_param? (|> pH (_.< (_.int +0)))] + (_.cond (list [negative_subject? + (_.if negative_param? + (i64::* (i64::opposite param) + (i64::opposite subject)) + (i64::opposite (i64::* param + (i64::opposite subject))))] + + [negative_param? + (i64::opposite (i64::* (i64::opposite param) + subject))]) + (all _.then + (_.set! sL (|> subject i64_low)) + (_.set! pL (|> param i64_low)) + (let [bits16 (_.manual "0xFFFF") + move_top_16 (_.bit_shl (_.int +16)) + top_16 (_.bit_ushr (_.int +16)) + bottom_16 (_.bit_and bits16) + split_16 (function (_ source) + [(|> source top_16) + (|> source bottom_16)]) + split_int (function (_ high low) + [(split_16 high) + (split_16 low)]) + new_half (function (_ top bottom) + (|> top bottom_16 move_top_16 + (_.bit_or (bottom_16 bottom)))) + x16_top (|> x16 top_16) + x32_top (|> x32 top_16)] + (with_vars [s48 s32 s16 s00 + p48 p32 p16 p00] + (let [[[_s48 _s32] [_s16 _s00]] (split_int sH sL) + [[_p48 _p32] [_p16 _p00]] (split_int pH pL) + set_subject_chunks! (all _.then (_.set! s48 _s48) (_.set! s32 _s32) (_.set! s16 _s16) (_.set! s00 _s00)) + set_param_chunks! (all _.then (_.set! p48 _p48) (_.set! p32 _p32) (_.set! p16 _p16) (_.set! p00 _p00))] + (all _.then + set_subject_chunks! + set_param_chunks! + (_.set! x00 (|> s00 (_.* p00))) + (_.set! x16 (|> x00 top_16 (_.+ (|> s16 (_.* p00))))) + (_.set! x32 x16_top) + (_.set! x16 (|> x16 bottom_16 (_.+ (|> s00 (_.* p16))))) + (_.set! x32 (|> x32 (_.+ x16_top) (_.+ (|> s32 (_.* p00))))) + (_.set! x48 x32_top) + (_.set! x32 (|> x32 bottom_16 (_.+ (|> s16 (_.* p16))))) + (_.set! x48 (|> x48 (_.+ x32_top))) + (_.set! x32 (|> x32 bottom_16 (_.+ (|> s00 (_.* p32))))) + (_.set! x48 (|> x48 (_.+ x32_top) + (_.+ (|> s48 (_.* p00))) + (_.+ (|> s32 (_.* p16))) + (_.+ (|> s16 (_.* p32))) + (_.+ (|> s00 (_.* p48))))) + (i64::new (new_half x48 x32) + (new_half x16 x00))))) + ))))))) (def: (limit_shift! shift) (-> SVar Expression) @@ -388,20 +388,20 @@ input]) (runtime: (i64::left_shifted shift input) - ($_ _.then - (limit_shift! shift) - (_.cond (list (no_shift_clause shift input) - [(|> shift (_.< (_.int +32))) - (let [mid (|> (i64_low input) (_.bit_ushr (|> (_.int +32) (_.- shift)))) - high (|> (i64_high input) - (_.bit_shl shift) - (_.bit_or mid)) - low (|> (i64_low input) - (_.bit_shl shift))] - (i64::new high low))]) - (let [high (|> (i64_high input) - (_.bit_shl (|> shift (_.- (_.int +32)))))] - (i64::new high (_.int +0)))))) + (all _.then + (limit_shift! shift) + (_.cond (list (no_shift_clause shift input) + [(|> shift (_.< (_.int +32))) + (let [mid (|> (i64_low input) (_.bit_ushr (|> (_.int +32) (_.- shift)))) + high (|> (i64_high input) + (_.bit_shl shift) + (_.bit_or mid)) + low (|> (i64_low input) + (_.bit_shl shift))] + (i64::new high low))]) + (let [high (|> (i64_high input) + (_.bit_shl (|> shift (_.- (_.int +32)))))] + (i64::new high (_.int +0)))))) (runtime: (i64::arithmetic_right_shifted_32 shift input) (let [top_bit (|> input (_.bit_and (_.as::integer (_.int (hex "+80000000")))))] @@ -410,24 +410,24 @@ (_.bit_or top_bit)))) (runtime: (i64::arithmetic_right_shifted shift input) - ($_ _.then - (limit_shift! shift) - (_.cond (list (no_shift_clause shift input) - [(|> shift (_.< (_.int +32))) - (let [mid (|> (i64_high input) (_.bit_shl (|> (_.int +32) (_.- shift)))) - high (|> (i64_high input) - (i64::arithmetic_right_shifted_32 shift)) - low (|> (i64_low input) - (_.bit_ushr shift) - (_.bit_or mid))] - (i64::new high low))]) - (let [low (|> (i64_high input) - (i64::arithmetic_right_shifted_32 (|> shift (_.- (_.int +32))))) - high (_.if (_.< (_.int +0) - (i64_high input)) - (_.int -1) - (_.int +0))] - (i64::new high low))))) + (all _.then + (limit_shift! shift) + (_.cond (list (no_shift_clause shift input) + [(|> shift (_.< (_.int +32))) + (let [mid (|> (i64_high input) (_.bit_shl (|> (_.int +32) (_.- shift)))) + high (|> (i64_high input) + (i64::arithmetic_right_shifted_32 shift)) + low (|> (i64_low input) + (_.bit_ushr shift) + (_.bit_or mid))] + (i64::new high low))]) + (let [low (|> (i64_high input) + (i64::arithmetic_right_shifted_32 (|> shift (_.- (_.int +32))))) + high (_.if (_.< (_.int +0) + (i64_high input)) + (_.int -1) + (_.int +0))] + (i64::new high low))))) (runtime: (i64::/ param subject) (let [negative? (|>> (i64::< i64::zero)) @@ -445,21 +445,21 @@ [(|> param (i64::= i64::min)) i64::one]) (with_vars [approximation] - ($_ _.then - (_.set! approximation - (|> subject - (i64::arithmetic_right_shifted (_.int +1)) - (i64::/ param) - (i64::left_shifted (_.int +1)))) - (_.if (|> approximation (i64::= i64::zero)) - (_.if (negative? param) - i64::one - i64::-one) - (let [remainder (i64::- (i64::* param approximation) - subject)] - (|> remainder - (i64::/ param) - (i64::+ approximation)))))))] + (all _.then + (_.set! approximation + (|> subject + (i64::arithmetic_right_shifted (_.int +1)) + (i64::/ param) + (i64::left_shifted (_.int +1)))) + (_.if (|> approximation (i64::= i64::zero)) + (_.if (negative? param) + i64::one + i64::-one) + (let [remainder (i64::- (i64::* param approximation) + subject)] + (|> remainder + (i64::/ param) + (i64::+ approximation)))))))] [(|> param (i64::= i64::min)) i64::zero] @@ -477,41 +477,41 @@ (i64::/ subject) i64::opposite)]) (with_vars [result remainder approximate approximate_result log2 approximate_remainder] - ($_ _.then - (_.set! result i64::zero) - (_.set! remainder subject) - (_.while (|> (|> remainder (i64::< param)) - (_.or (|> remainder (i64::= param)))) - (let [calc_rough_estimate (_.apply (list (|> (i64::float remainder) (_./ (i64::float param)))) - (_.var "floor")) - calc_approximate_result (i64::of_float approximate) - calc_approximate_remainder (|> approximate_result (i64::* param)) - delta (_.if (_.> log2 (_.float +48.0)) - (_.** (|> log2 (_.- (_.float +48.0))) - (_.float +2.0)) - (_.float +1.0))] - ($_ _.then - (_.set! approximate (_.apply (list (_.float +1.0) calc_rough_estimate) - (_.var "max"))) - (_.set! log2 (let [log (function (_ input) - (_.apply (list input) (_.var "log")))] - (_.apply (list (|> (log (_.int +2)) - (_./ (log approximate)))) - (_.var "ceil")))) - (_.set! approximate_result calc_approximate_result) - (_.set! approximate_remainder calc_approximate_remainder) - (_.while (|> (negative? approximate_remainder) - (_.or (|> approximate_remainder (i64::< remainder)))) - ($_ _.then - (_.set! approximate (|> delta (_.- approximate))) - (_.set! approximate_result calc_approximate_result) - (_.set! approximate_remainder calc_approximate_remainder))) - (_.set! result (|> (_.if (|> approximate_result (i64::= i64::zero)) - i64::one - approximate_result) - (i64::+ result))) - (_.set! remainder (|> remainder (i64::- approximate_remainder)))))) - result)) + (all _.then + (_.set! result i64::zero) + (_.set! remainder subject) + (_.while (|> (|> remainder (i64::< param)) + (_.or (|> remainder (i64::= param)))) + (let [calc_rough_estimate (_.apply (list (|> (i64::float remainder) (_./ (i64::float param)))) + (_.var "floor")) + calc_approximate_result (i64::of_float approximate) + calc_approximate_remainder (|> approximate_result (i64::* param)) + delta (_.if (_.> log2 (_.float +48.0)) + (_.** (|> log2 (_.- (_.float +48.0))) + (_.float +2.0)) + (_.float +1.0))] + (all _.then + (_.set! approximate (_.apply (list (_.float +1.0) calc_rough_estimate) + (_.var "max"))) + (_.set! log2 (let [log (function (_ input) + (_.apply (list input) (_.var "log")))] + (_.apply (list (|> (log (_.int +2)) + (_./ (log approximate)))) + (_.var "ceil")))) + (_.set! approximate_result calc_approximate_result) + (_.set! approximate_remainder calc_approximate_remainder) + (_.while (|> (negative? approximate_remainder) + (_.or (|> approximate_remainder (i64::< remainder)))) + (all _.then + (_.set! approximate (|> delta (_.- approximate))) + (_.set! approximate_result calc_approximate_result) + (_.set! approximate_remainder calc_approximate_remainder))) + (_.set! result (|> (_.if (|> approximate_result (i64::= i64::zero)) + i64::one + approximate_result) + (i64::+ result))) + (_.set! remainder (|> remainder (i64::- approximate_remainder)))))) + result)) ))) (runtime: (i64::% param subject) @@ -520,9 +520,9 @@ (runtime: (lux::try op) (with_vars [error value] - (_.try ($_ _.then - (_.set! value (_.apply (list ..unit) op)) - (..right value)) + (_.try (all _.then + (_.set! value (_.apply (list ..unit) op)) + (..right value)) {.#None} {.#Some (_.function (list error) (..left (_.item (_.string "message") @@ -531,18 +531,18 @@ (runtime: (lux::program_args program_args) (with_vars [inputs value] - ($_ _.then - (_.set! inputs ..none) - (<| (_.for_in value program_args) - (_.set! inputs (..some (_.list (list value inputs))))) - inputs))) + (all _.then + (_.set! inputs ..none) + (<| (_.for_in value program_args) + (_.set! inputs (..some (_.list (list value inputs))))) + inputs))) (def: runtime::lux Expression - ($_ _.then - @lux::try - @lux::program_args - )) + (all _.then + @lux::try + @lux::program_args + )) (def: current_time_float Expression @@ -556,9 +556,9 @@ (def: runtime::io Expression - ($_ _.then - @io::current_time! - )) + (all _.then + @io::current_time! + )) (def: minimum_index_length (-> SVar Expression) @@ -578,28 +578,28 @@ (runtime: (tuple::left index product) (let [$index_min_length (_.var "index_min_length")] - ($_ _.then - (_.set! $index_min_length (minimum_index_length index)) - (_.if (|> (_.length product) (_.> $index_min_length)) - ... No need for recursion - (product_element product index) - ... Needs recursion - (tuple::left (updated_index $index_min_length product) - (product_tail product)))))) + (all _.then + (_.set! $index_min_length (minimum_index_length index)) + (_.if (|> (_.length product) (_.> $index_min_length)) + ... No need for recursion + (product_element product index) + ... Needs recursion + (tuple::left (updated_index $index_min_length product) + (product_tail product)))))) (runtime: (tuple::right index product) (let [$index_min_length (_.var "index_min_length")] - ($_ _.then - (_.set! $index_min_length (minimum_index_length index)) - (_.cond (list [... Last element. - (|> (_.length product) (_.= $index_min_length)) - (product_element product index)] - [... Needs recursion - (|> (_.length product) (_.< $index_min_length)) - (tuple::right (updated_index $index_min_length product) - (product_tail product))]) - ... Must slice - (|> product (_.slice_from index)))))) + (all _.then + (_.set! $index_min_length (minimum_index_length index)) + (_.cond (list [... Last element. + (|> (_.length product) (_.= $index_min_length)) + (product_element product index)] + [... Needs recursion + (|> (_.length product) (_.< $index_min_length)) + (tuple::right (updated_index $index_min_length product) + (product_tail product))]) + ... Must slice + (|> product (_.slice_from index)))))) (runtime: (sum::get sum wants_last? wanted_tag) (let [no_match _.null @@ -629,12 +629,12 @@ (def: runtime::adt Expression - ($_ _.then - @tuple::left - @tuple::right - @sum::get - @adt::variant - )) + (all _.then + @tuple::left + @tuple::right + @sum::get + @adt::variant + )) (template [<name> <op>] [(runtime: (<name> mask input) @@ -649,75 +649,75 @@ ) (runtime: (i64::right_shifted shift input) - ($_ _.then - (limit_shift! shift) - (_.cond (list (no_shift_clause shift input) - [(|> shift (_.< (_.int +32))) - (with_vars [$mid] - (let [mid (|> (i64_high input) (_.bit_shl (|> (_.int +32) (_.- shift)))) - high (|> (i64_high input) (_.bit_ushr shift)) - low (|> (i64_low input) - (_.bit_ushr shift) - (_.bit_or (_.if (_.apply (list $mid) (_.var "is.na")) - (_.as::integer (_.int +0)) - $mid)))] - ($_ _.then - (_.set! $mid mid) - (i64::new high low))))] - [(|> shift (_.= (_.int +32))) - (let [high (i64_high input)] - (i64::new (_.int +0) high))]) - (let [low (|> (i64_high input) (_.bit_ushr (|> shift (_.- (_.int +32)))))] - (i64::new (_.int +0) low))))) + (all _.then + (limit_shift! shift) + (_.cond (list (no_shift_clause shift input) + [(|> shift (_.< (_.int +32))) + (with_vars [$mid] + (let [mid (|> (i64_high input) (_.bit_shl (|> (_.int +32) (_.- shift)))) + high (|> (i64_high input) (_.bit_ushr shift)) + low (|> (i64_low input) + (_.bit_ushr shift) + (_.bit_or (_.if (_.apply (list $mid) (_.var "is.na")) + (_.as::integer (_.int +0)) + $mid)))] + (all _.then + (_.set! $mid mid) + (i64::new high low))))] + [(|> shift (_.= (_.int +32))) + (let [high (i64_high input)] + (i64::new (_.int +0) high))]) + (let [low (|> (i64_high input) (_.bit_ushr (|> shift (_.- (_.int +32)))))] + (i64::new (_.int +0) low))))) (def: runtime::i64 Expression - ($_ _.then - @f2^32 - @f2^63 - - @i64::new - @i64::of_float - - @i64::and - @i64::or - @i64::xor - @i64::not - @i64::left_shifted - @i64::arithmetic_right_shifted_32 - @i64::arithmetic_right_shifted - @i64::right_shifted - - @i64::zero - @i64::one - @i64::min - @i64::max - @i64::= - @i64::< - @i64::+ - @i64::- - @i64::opposite - @i64::-one - @i64::unsigned_low - @i64::float - @i64::* - @i64::/ - @i64::% - )) + (all _.then + @f2^32 + @f2^63 + + @i64::new + @i64::of_float + + @i64::and + @i64::or + @i64::xor + @i64::not + @i64::left_shifted + @i64::arithmetic_right_shifted_32 + @i64::arithmetic_right_shifted + @i64::right_shifted + + @i64::zero + @i64::one + @i64::min + @i64::max + @i64::= + @i64::< + @i64::+ + @i64::- + @i64::opposite + @i64::-one + @i64::unsigned_low + @i64::float + @i64::* + @i64::/ + @i64::% + )) (runtime: (frac::decode input) (with_vars [output] - ($_ _.then - (_.set! output (_.apply (list input) (_.var "as.numeric"))) - (_.if (|> output (_.= _.n/a)) - ..none - (..some output))))) + (all _.then + (_.set! output (_.apply (list input) (_.var "as.numeric"))) + (_.if (|> output (_.= _.n/a)) + ..none + (..some output))))) (def: runtime::frac Expression - ($_ _.then - @frac::decode - )) + (all _.then + @frac::decode + )) (def: ++ (-> Expression Expression) @@ -734,32 +734,32 @@ (runtime: (text::index subject param start) (with_vars [idx startF subjectL] - ($_ _.then - (_.set! startF (i64::float start)) - (_.set! subjectL (text_length subject)) - (_.if (_.< subjectL startF) - ($_ _.then - (_.set! idx (|> (_.apply_kw (list param (_.if (|> startF (_.= (_.int +0))) - subject - (text_clip (++ startF) - (++ subjectL) - subject))) - (list ["fixed" (_.bool #1)]) - (_.var "regexpr")) - (_.item (_.int +1)))) - (_.if (|> idx (_.= (_.int -1))) - ..none - (..some (i64::of_float (|> idx (_.+ startF)))))) - ..none)))) + (all _.then + (_.set! startF (i64::float start)) + (_.set! subjectL (text_length subject)) + (_.if (_.< subjectL startF) + (all _.then + (_.set! idx (|> (_.apply_kw (list param (_.if (|> startF (_.= (_.int +0))) + subject + (text_clip (++ startF) + (++ subjectL) + subject))) + (list ["fixed" (_.bool #1)]) + (_.var "regexpr")) + (_.item (_.int +1)))) + (_.if (|> idx (_.= (_.int -1))) + ..none + (..some (i64::of_float (|> idx (_.+ startF)))))) + ..none)))) (runtime: (text::clip text minimum additional) (with_vars [length] - ($_ _.then - (_.set! length (_.length text)) - (_.set! to (_.+ additional minimum)) - (_.if (_.< length to) - (..some (text_clip (++ minimum) (++ to) text)) - ..none)))) + (all _.then + (_.set! length (_.length text)) + (_.set! to (_.+ additional minimum)) + (_.if (_.< length to) + (..some (text_clip (++ minimum) (++ to) text)) + ..none)))) (def: (char_at idx text) (-> Expression Expression Expression) @@ -768,18 +768,18 @@ (runtime: (text::char text idx) (_.if (_.< (_.length text) idx) - ($_ _.then - (_.set! idx (++ idx)) - (..some (i64::of_float (char_at idx text)))) + (all _.then + (_.set! idx (++ idx)) + (..some (i64::of_float (char_at idx text)))) ..none)) (def: runtime::text Expression - ($_ _.then - @text::index - @text::clip - @text::char - )) + (all _.then + @text::index + @text::clip + @text::char + )) (def: (check_index_out_of_bounds array idx body) (-> Expression Expression Expression Expression) @@ -789,47 +789,47 @@ (runtime: (array::new size) (with_vars [output] - ($_ _.then - (_.set! output (_.list (list))) - (_.set_item! (|> size (_.+ (_.int +1))) - _.null - output) - output))) + (all _.then + (_.set! output (_.list (list))) + (_.set_item! (|> size (_.+ (_.int +1))) + _.null + output) + output))) (runtime: (array::get array idx) (with_vars [temp] (<| (check_index_out_of_bounds array idx) - ($_ _.then - (_.set! temp (|> array (_.item (_.+ (_.int +1) idx)))) - (_.if (|> temp (_.= _.null)) - ..none - (..some temp)))))) + (all _.then + (_.set! temp (|> array (_.item (_.+ (_.int +1) idx)))) + (_.if (|> temp (_.= _.null)) + ..none + (..some temp)))))) (runtime: (array::put array idx value) (<| (check_index_out_of_bounds array idx) - ($_ _.then - (_.set_item! (_.+ (_.int +1) idx) value array) - array))) + (all _.then + (_.set_item! (_.+ (_.int +1) idx) value array) + array))) (def: runtime::array Expression - ($_ _.then - @array::new - @array::get - @array::put - )) + (all _.then + @array::new + @array::get + @array::put + )) (def: runtime Expression - ($_ _.then - runtime::lux - runtime::i64 - runtime::adt - runtime::frac - runtime::text - runtime::array - runtime::io - )) + (all _.then + runtime::lux + runtime::i64 + runtime::adt + runtime::frac + runtime::text + runtime::array + runtime::io + )) (def: .public generate (Operation [Registry Output]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 284fa79c6..677f622b1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -65,10 +65,10 @@ (do ///////phase.monad [this (expression archive this) that (statement expression archive that)] - (in ($_ _.then - (_.statement this) - that - )))) + (in (all _.then + (_.statement this) + that + )))) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) @@ -86,9 +86,9 @@ (do ///////phase.monad [valueO (expression archive valueS) bodyO (statement expression archive bodyS)] - (in ($_ _.then - (_.set (list (..register register)) valueO) - bodyO)))) + (in (all _.then + (_.set (list (..register register)) valueO) + bodyO)))) (def: .public (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) @@ -162,15 +162,15 @@ (template [<name> <flag>] [(def: (<name> simple? idx) (-> Bit Nat Statement) - ($_ _.then - (_.set (list @temp) (//runtime.sum//get ..peek <flag> - (|> idx .int _.int))) - (.if simple? - (_.when (_.= _.nil @temp) - fail!) - (_.if (_.= _.nil @temp) - fail! - (..push! @temp)))))] + (all _.then + (_.set (list @temp) (//runtime.sum//get ..peek <flag> + (|> idx .int _.int))) + (.if simple? + (_.when (_.= _.nil @temp) + fail!) + (_.if (_.= _.nil @temp) + fail! + (..push! @temp)))))] [left_choice _.nil] [right_choice //runtime.unit] @@ -179,32 +179,32 @@ (def: (with_looping in_closure? g!once g!continue? body!) (-> Bit LVar LVar Statement Statement) (.if in_closure? - ($_ _.then - (_.while (_.bool true) - body!)) - ($_ _.then - (_.set (list g!once) (_.bool true)) - (_.set (list g!continue?) (_.bool false)) - (<| (_.while (_.bool true)) - (_.if g!once - ($_ _.then - (_.set (list g!once) (_.bool false)) - body!) - ($_ _.then - (_.set (list g!continue?) (_.bool true)) - _.break))) - (_.when g!continue? - _.next)))) + (all _.then + (_.while (_.bool true) + body!)) + (all _.then + (_.set (list g!once) (_.bool true)) + (_.set (list g!continue?) (_.bool false)) + (<| (_.while (_.bool true)) + (_.if g!once + (all _.then + (_.set (list g!once) (_.bool false)) + body!) + (all _.then + (_.set (list g!continue?) (_.bool true)) + _.break))) + (_.when g!continue? + _.next)))) (def: (alternation in_closure? g!once g!continue? pre! post!) (-> Bit LVar LVar Statement Statement Statement) - ($_ _.then - (with_looping in_closure? g!once g!continue? - ($_ _.then - ..save! - pre!)) - ..restore! - post!)) + (all _.then + (with_looping in_closure? g!once g!continue? + (all _.then + ..save! + pre!)) + ..restore! + post!)) (def: (primitive_pattern_matching again pathP) (-> (-> Path (Operation Statement)) @@ -324,25 +324,25 @@ (pattern (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (again thenP)] - (///////phase#in ($_ _.then - (_.set (list (..register register)) ..peek_and_pop) - then!))) + (///////phase#in (all _.then + (_.set (list (..register register)) ..peek_and_pop) + then!))) (pattern (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (case.count_pops nextP)] (do ///////phase.monad [next! (again nextP')] - (///////phase#in ($_ _.then - (..multi_pop! (n.+ 2 extra_pops)) - next!)))) + (///////phase#in (all _.then + (..multi_pop! (n.+ 2 extra_pops)) + next!)))) (pattern (/////synthesis.path/seq preP postP)) (do ///////phase.monad [pre! (again preP) post! (again postP)] - (in ($_ _.then - pre! - post!))) + (in (all _.then + pre! + post!))) (pattern (/////synthesis.path/alt preP postP)) (do ///////phase.monad @@ -358,21 +358,21 @@ [pattern_matching! (pattern_matching' in_closure? statement expression archive pathP) g!once (..symbol "once") g!continue? (..symbol "continue")] - (in ($_ _.then - (..with_looping in_closure? g!once g!continue? - pattern_matching!) - (_.statement (_.raise (_.string case.pattern_matching_error))))))) + (in (all _.then + (..with_looping in_closure? g!once g!continue? + pattern_matching!) + (_.statement (_.raise (_.string case.pattern_matching_error))))))) (def: .public (case! in_closure? statement expression archive [valueS pathP]) (-> Bit (Generator! [Synthesis Path])) (do ///////phase.monad [stack_init (expression archive valueS) pattern_matching! (pattern_matching in_closure? statement expression archive pathP)] - (in ($_ _.then - (_.set (list @cursor) (_.array (list stack_init))) - (_.set (list @savepoint) (_.array (list))) - pattern_matching! - )))) + (in (all _.then + (_.set (list @cursor) (_.array (list stack_init))) + (_.set (list @savepoint) (_.array (list))) + pattern_matching! + )))) (def: .public (case statement expression archive case) (-> Phase! (Generator [Synthesis Path])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index f6b20a5d6..45e8363c3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -56,9 +56,9 @@ [(|> (list.enumeration inits) (list#each (|>> product.left ..capture))) (let [@self (_.local self)] - ($_ _.then - (_.set (list @self) function_definition) - (_.return @self)))])) + (all _.then + (_.set (list @self) function_definition) + (_.return @self)))])) (_.apply_lambda/* inits @self)]))) (def: input @@ -86,37 +86,37 @@ (_.local function_name))) initialize_self! (_.set (list (//case.register 0)) @self) initialize! (list#mix (.function (_ post pre!) - ($_ _.then - pre! - (_.set (list (..input post)) (_.item (|> post .int _.int) @curried)))) + (all _.then + pre! + (_.set (list (..input post)) (_.item (|> post .int _.int) @curried)))) initialize_self! (list.indices arity)) [declaration instatiation] (with_closure closureO+ function_name (_.lambda {.#None} [(list (_.variadic @curried)) - ($_ _.then - (_.set (list @num_args) (_.the "length" @curried)) - (<| (_.if (|> @num_args (_.= arityO)) - (<| (_.then initialize!) - //loop.with_scope - body!)) - (_.if (|> @num_args (_.> arityO)) - (let [slice (.function (_ from to) - (_.array_range from to @curried)) - arity_args (_.splat (slice (_.int +0) limitO)) - output_func_args (_.splat (slice arityO @num_args))] - (_.return (|> @self - (_.apply_lambda/* (list arity_args)) - (_.apply_lambda/* (list output_func_args)))))) - ... (|> @num_args (_.< arityO)) - (let [@missing (_.local "missing")] - (_.return (_.lambda {.#None} - [(list (_.variadic @missing)) - (_.return (|> @self - (_.apply_lambda/* (list (_.splat (|> (_.array (list)) - (_.do "concat" (list @curried) {.#None}) - (_.do "concat" (list @missing) {.#None})))))))])))) - )]))] + (all _.then + (_.set (list @num_args) (_.the "length" @curried)) + (<| (_.if (|> @num_args (_.= arityO)) + (<| (_.then initialize!) + //loop.with_scope + body!)) + (_.if (|> @num_args (_.> arityO)) + (let [slice (.function (_ from to) + (_.array_range from to @curried)) + arity_args (_.splat (slice (_.int +0) limitO)) + output_func_args (_.splat (slice arityO @num_args))] + (_.return (|> @self + (_.apply_lambda/* (list arity_args)) + (_.apply_lambda/* (list output_func_args)))))) + ... (|> @num_args (_.< arityO)) + (let [@missing (_.local "missing")] + (_.return (_.lambda {.#None} + [(list (_.variadic @missing)) + (_.return (|> @self + (_.apply_lambda/* (list (_.splat (|> (_.array (list)) + (_.do "concat" (list @curried) {.#None}) + (_.do "concat" (list @missing) {.#None})))))))])))) + )]))] _ (/////generation.execute! declaration) _ (/////generation.save! function_artifact {.#None} declaration)] (in instatiation))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index b69ce6b57..08ebeaf0e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -1,44 +1,44 @@ (.using - [library - [lux {"-" Scope symbol} - [abstract - ["[0]" monad {"+" do}]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)] - ["[0]" set]]] - [math - [number - ["n" nat]]] - [target - ["_" ruby {"+" Expression LVar Statement}]]]] - ["[0]" // "_" - [runtime {"+" Operation Phase Generator Phase! Generator!}] - ["[1][0]" case] + [library + [lux {"-" Scope symbol} + [abstract + ["[0]" monad {"+" do}]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)] + ["[0]" set]]] + [math + [number + ["n" nat]]] + [target + ["_" ruby {"+" Expression LVar Statement}]]]] + ["[0]" // "_" + [runtime {"+" Operation Phase Generator Phase! Generator!}] + ["[1][0]" case] + ["/[1]" // "_" + ["[1][0]" reference] ["/[1]" // "_" - ["[1][0]" reference] + [synthesis + ["[0]" case]] ["/[1]" // "_" - [synthesis - ["[0]" case]] - ["/[1]" // "_" - ["[0]" synthesis {"+" Scope Synthesis}] - ["[1][0]" generation] - ["//[1]" /// "_" - ["[1][0]" phase] - [reference - ["[1][0]" variable {"+" Register}]]]]]]]) + ["[0]" synthesis {"+" Scope Synthesis}] + ["[1][0]" generation] + ["//[1]" /// "_" + ["[1][0]" phase] + [reference + ["[1][0]" variable {"+" Register}]]]]]]]) (def: (setup offset bindings body) (-> Register (List Expression) Statement Statement) (let [variables (|> bindings list.enumeration (list#each (|>> product.left (n.+ offset) //case.register)))] - ($_ _.then - (_.set variables (_.multi bindings)) - body))) + (all _.then + (_.set variables (_.multi bindings)) + body))) (def: symbol (_.symbol "lux_continue")) @@ -89,7 +89,7 @@ list.enumeration (list#each (function (_ [idx _]) (_.item (_.int (.int idx)) @temp))))]] - (in ($_ _.then - (_.set (list @temp) (_.array argsO+)) - (..setup offset re_binds - _.next))))) + (in (all _.then + (_.set (list @temp) (_.array argsO+)) + (..setup offset re_binds + _.next))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index ed673e53a..576f8f24c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -157,33 +157,33 @@ (def: last_index (|>> ..tuple_size (_.- (_.int +1)))) -(with_expansions [<recur> (these ($_ _.then - (_.set (list lefts) (_.- last_index_right lefts)) - (_.set (list tuple) (_.item last_index_right tuple))))] +(with_expansions [<recur> (these (all _.then + (_.set (list lefts) (_.- last_index_right lefts)) + (_.set (list tuple) (_.item last_index_right tuple))))] (runtime: (tuple//left lefts tuple) (with_vars [last_index_right] (<| (_.while (_.bool true)) - ($_ _.then - (_.set (list last_index_right) (..last_index tuple)) - (_.if (_.> lefts last_index_right) - ... No need for recursion - (_.return (_.item lefts tuple)) - ... Needs recursion - <recur>))))) + (all _.then + (_.set (list last_index_right) (..last_index tuple)) + (_.if (_.> lefts last_index_right) + ... No need for recursion + (_.return (_.item lefts tuple)) + ... Needs recursion + <recur>))))) (runtime: (tuple//right lefts tuple) (with_vars [last_index_right right_index] (<| (_.while (_.bool true)) - ($_ _.then - (_.set (list last_index_right) (..last_index tuple)) - (_.set (list right_index) (_.+ (_.int +1) lefts)) - (<| (_.if (_.= last_index_right right_index) - (_.return (_.item right_index tuple))) - (_.if (_.> last_index_right right_index) - ... Needs recursion. - <recur>) - (_.return (_.array_range right_index (..tuple_size tuple) tuple))) - ))))) + (all _.then + (_.set (list last_index_right) (..last_index tuple)) + (_.set (list right_index) (_.+ (_.int +1) lefts)) + (<| (_.if (_.= last_index_right right_index) + (_.return (_.item right_index tuple))) + (_.if (_.> last_index_right right_index) + ... Needs recursion. + <recur>) + (_.return (_.array_range right_index (..tuple_size tuple) tuple))) + ))))) (def: .public variant_tag_field "_lux_tag") (def: .public variant_flag_field "_lux_flag") @@ -219,11 +219,11 @@ actual##lefts (_.item (_.string ..variant_tag_field) sum) actual##right? (_.item (_.string ..variant_flag_field) sum) actual##value (_.item (_.string ..variant_value_field) sum) - recur! ($_ _.then - (_.set (list expected##lefts) (|> expected##lefts - (_.- actual##lefts) - (_.- (_.int +1)))) - (_.set (list sum) actual##value))] + recur! (all _.then + (_.set (list expected##lefts) (|> expected##lefts + (_.- actual##lefts) + (_.- (_.int +1)))) + (_.set (list sum) actual##value))] (<| (_.while (_.bool true)) (_.if (_.= expected##lefts actual##lefts) (_.if (_.= expected##right? actual##right?) @@ -243,35 +243,35 @@ (def: runtime//adt Statement - ($_ _.then - @tuple//left - @tuple//right - @sum//make - @sum//get - )) + (all _.then + @tuple//left + @tuple//right + @sum//make + @sum//get + )) (runtime: (lux//try risky) (with_vars [error value] - (_.begin ($_ _.then - (_.set (list value) (_.apply_lambda/* (list ..unit) risky)) - (_.return (..right value))) + (_.begin (all _.then + (_.set (list value) (_.apply_lambda/* (list ..unit) risky)) + (_.return (..right value))) (list [(list) error (_.return (..left (_.the "message" error)))])))) (runtime: (lux//program_args raw) (with_vars [tail head] - ($_ _.then - (_.set (list tail) ..none) - (<| (_.for_in head raw) - (_.set (list tail) (..some (_.array (list head tail))))) - (_.return tail)))) + (all _.then + (_.set (list tail) ..none) + (<| (_.for_in head raw) + (_.set (list tail) (..some (_.array (list head tail))))) + (_.return tail)))) (def: runtime//lux Statement - ($_ _.then - @lux//try - @lux//program_args - )) + (all _.then + @lux//try + @lux//program_args + )) (def: i64##+limit (_.manual "+0x7FFFFFFFFFFFFFFF")) (def: i64##-limit (_.manual "-0x8000000000000000")) @@ -286,11 +286,11 @@ (with_vars [temp] (`` (<| (~~ (template [<scenario> <iteration> <cap> <entrance>] [(_.if (|> input <scenario>) - ($_ _.then - (_.set (list temp) (_.% <iteration> input)) - (_.return (_.? (|> temp <scenario>) - (|> temp (_.- <cap>) (_.+ <entrance>)) - temp))))] + (all _.then + (_.set (list temp) (_.% <iteration> input)) + (_.return (_.? (|> temp <scenario>) + (|> temp (_.- <cap>) (_.+ <entrance>)) + temp))))] [(_.> ..i64##+limit) ..i64##+iteration ..i64##+cap ..i64##-limit] [(_.< ..i64##-limit) ..i64##-iteration ..i64##-cap ..i64##+limit] @@ -327,10 +327,10 @@ [(runtime: (<runtime> left right) [..normal_ruby? (_.return (..i64##i64 (<host> (..as_nat left) (..as_nat right))))] (with_vars [high low] - ($_ _.then - (_.set (list high) (<host> (i32##high left) (..i32##high right))) - (_.set (list low) (<host> (i32##low left) (..i32##low right))) - (_.return (..i64 high low)))))] + (all _.then + (_.set (list high) (<host> (i32##high left) (..i32##high right))) + (_.set (list low) (<host> (i32##low left) (..i32##low right))) + (_.return (..i64 high low)))))] [i64##and _.bit_and] [i64##or _.bit_or] @@ -355,43 +355,43 @@ (_.bit_shl (_.% (_.int +64) shift)) ..i64##i64))] (with_vars [high low] - ($_ _.then - (..cap_shift! shift) - (<| (..handle_no_shift! shift input) - (_.if (..small_shift? shift) - ($_ _.then - (_.set (list high) (_.bit_or (|> input i32##high (_.bit_shl shift)) - (|> input i32##low (_.bit_shr (_.- shift (_.int +32)))))) - (_.set (list low) (|> input i32##low (_.bit_shl shift))) + (all _.then + (..cap_shift! shift) + (<| (..handle_no_shift! shift input) + (_.if (..small_shift? shift) + (all _.then + (_.set (list high) (_.bit_or (|> input i32##high (_.bit_shl shift)) + (|> input i32##low (_.bit_shr (_.- shift (_.int +32)))))) + (_.set (list low) (|> input i32##low (_.bit_shl shift))) + (_.return (..i64 (i32##low high) + (i32##low low))))) + (all _.then + (_.set (list high) (|> input i32##low (_.bit_shl (_.- (_.int +32) shift)))) (_.return (..i64 (i32##low high) - (i32##low low))))) - ($_ _.then - (_.set (list high) (|> input i32##low (_.bit_shl (_.- (_.int +32) shift)))) - (_.return (..i64 (i32##low high) - (_.int +0))))) - ))) + (_.int +0))))) + ))) (runtime: (i64##right_shifted shift input) - [..normal_ruby? ($_ _.then - (_.set (list shift) (_.% (_.int +64) shift)) - (_.return (_.? (_.= (_.int +0) shift) - input - (|> input - ..as_nat - (_.bit_shr shift)))))] + [..normal_ruby? (all _.then + (_.set (list shift) (_.% (_.int +64) shift)) + (_.return (_.? (_.= (_.int +0) shift) + input + (|> input + ..as_nat + (_.bit_shr shift)))))] (with_vars [high low] - ($_ _.then - (..cap_shift! shift) - (<| (..handle_no_shift! shift input) - (_.if (..small_shift? shift) - ($_ _.then - (_.set (list high) (|> input i32##high (_.bit_shr shift))) - (_.set (list low) (|> input i32##low (_.bit_shr shift) - (_.bit_or (|> input i32##high (_.bit_shl (_.- shift (_.int +32))))))) - (_.return (..i64 high low)))) - (_.return (_.? (|> shift (_.= (_.int +32))) - (i32##high input) - (|> input i32##high (_.bit_shr (_.- (_.int +32) shift))))))))) + (all _.then + (..cap_shift! shift) + (<| (..handle_no_shift! shift input) + (_.if (..small_shift? shift) + (all _.then + (_.set (list high) (|> input i32##high (_.bit_shr shift))) + (_.set (list low) (|> input i32##low (_.bit_shr shift) + (_.bit_or (|> input i32##high (_.bit_shl (_.- shift (_.int +32))))))) + (_.return (..i64 high low)))) + (_.return (_.? (|> shift (_.= (_.int +32))) + (i32##high input) + (|> input i32##high (_.bit_shr (_.- (_.int +32) shift))))))))) (runtime: (i64##/ parameter subject) (_.return (_.? (_.and (_.= (_.int -1) parameter) @@ -405,16 +405,16 @@ (runtime: (i64##+ parameter subject) [..normal_ruby? (_.return (i64##i64 (_.+ parameter subject)))] (with_vars [high low] - ($_ _.then - (_.set (list low) (_.+ (i32##low subject) - (i32##low parameter))) - (_.set (list high) (|> (i32##high low) - (_.+ (i32##high subject)) - (_.+ (i32##high parameter)) - i32##low)) + (all _.then + (_.set (list low) (_.+ (i32##low subject) + (i32##low parameter))) + (_.set (list high) (|> (i32##high low) + (_.+ (i32##high subject)) + (_.+ (i32##high parameter)) + i32##low)) - (_.return (..i64 high (i32##low low))) - ))) + (_.return (..i64 high (i32##low low))) + ))) (def: i64##min (_.manual "-0x8000000000000000")) @@ -447,44 +447,44 @@ r48 r32 r16 r00 x48 x32 x16 x00 high low] - ($_ _.then - (_.set (list l48) (hh subject)) - (_.set (list l32) (hl subject)) - (_.set (list l16) (lh subject)) - (_.set (list l00) (ll subject)) - - (_.set (list r48) (hh parameter)) - (_.set (list r32) (hl parameter)) - (_.set (list r16) (lh parameter)) - (_.set (list r00) (ll parameter)) - - (_.set (list x00) (_.* l00 r00)) - (_.set (list x16) (i16##high x00)) - (_.set (list x00) (i16##low x00)) - - (_.set (list x16) (|> x16 (_.+ (_.* l16 r00)))) - (_.set (list x32) (i16##high x16)) (_.set (list x16) (i16##low x16)) - (_.set (list x16) (|> x16 (_.+ (_.* l00 r16)))) - (_.set (list x32) (|> x32 (_.+ (i16##high x16)))) (_.set (list x16) (i16##low x16)) - - (_.set (list x32) (|> x32 (_.+ (_.* l32 r00)))) - (_.set (list x48) (i16##high x32)) (_.set (list x32) (i16##low x32)) - (_.set (list x32) (|> x32 (_.+ (_.* l16 r16)))) - (_.set (list x48) (|> x48 (_.+ (i16##high x32)))) (_.set (list x32) (i16##low x32)) - (_.set (list x32) (|> x32 (_.+ (_.* l00 r32)))) - (_.set (list x48) (|> x48 (_.+ (i16##high x32)))) (_.set (list x32) (i16##low x32)) - - (_.set (list x48) (|> x48 - (_.+ (_.* l48 r00)) - (_.+ (_.* l32 r16)) - (_.+ (_.* l16 r32)) - (_.+ (_.* l00 r48)) - i16##low)) - - (_.set (list high) (_.bit_or (i16##up x48) x32)) - (_.set (list low) (_.bit_or (i16##up x16) x00)) - (_.return (..i64 high low)) - ))) + (all _.then + (_.set (list l48) (hh subject)) + (_.set (list l32) (hl subject)) + (_.set (list l16) (lh subject)) + (_.set (list l00) (ll subject)) + + (_.set (list r48) (hh parameter)) + (_.set (list r32) (hl parameter)) + (_.set (list r16) (lh parameter)) + (_.set (list r00) (ll parameter)) + + (_.set (list x00) (_.* l00 r00)) + (_.set (list x16) (i16##high x00)) + (_.set (list x00) (i16##low x00)) + + (_.set (list x16) (|> x16 (_.+ (_.* l16 r00)))) + (_.set (list x32) (i16##high x16)) (_.set (list x16) (i16##low x16)) + (_.set (list x16) (|> x16 (_.+ (_.* l00 r16)))) + (_.set (list x32) (|> x32 (_.+ (i16##high x16)))) (_.set (list x16) (i16##low x16)) + + (_.set (list x32) (|> x32 (_.+ (_.* l32 r00)))) + (_.set (list x48) (i16##high x32)) (_.set (list x32) (i16##low x32)) + (_.set (list x32) (|> x32 (_.+ (_.* l16 r16)))) + (_.set (list x48) (|> x48 (_.+ (i16##high x32)))) (_.set (list x32) (i16##low x32)) + (_.set (list x32) (|> x32 (_.+ (_.* l00 r32)))) + (_.set (list x48) (|> x48 (_.+ (i16##high x32)))) (_.set (list x32) (i16##low x32)) + + (_.set (list x48) (|> x48 + (_.+ (_.* l48 r00)) + (_.+ (_.* l32 r16)) + (_.+ (_.* l16 r32)) + (_.+ (_.* l00 r48)) + i16##low)) + + (_.set (list high) (_.bit_or (i16##up x48) x32)) + (_.set (list low) (_.bit_or (i16##up x16) x00)) + (_.return (..i64 high low)) + ))) ) (runtime: (i64##char subject) @@ -493,48 +493,48 @@ (def: runtime//i64 Statement - ($_ _.then - @i64##+iteration - @i64##-iteration - @i64##i64 - @i64##left_shifted - @i64##right_shifted - @i64##and - @i64##or - @i64##xor - @i64##+ - @i64##- - @i64##* - @i64##/ - @i64##char - )) + (all _.then + @i64##+iteration + @i64##-iteration + @i64##i64 + @i64##left_shifted + @i64##right_shifted + @i64##and + @i64##or + @i64##xor + @i64##+ + @i64##- + @i64##* + @i64##/ + @i64##char + )) (runtime: (f64//decode inputG) (with_vars [@input @temp] - ($_ _.then - (_.set (list @input) inputG) - (_.set (list @temp) (_.do "to_f" (list) {.#None} @input)) - (_.if ($_ _.or - (_.not (_.= (_.float +0.0) @temp)) - (_.= (_.string "0") @input) - (_.= (_.string ".0") @input) - (_.= (_.string "0.0") @input)) - (_.return (..some @temp)) - (_.return ..none))))) + (all _.then + (_.set (list @input) inputG) + (_.set (list @temp) (_.do "to_f" (list) {.#None} @input)) + (_.if (all _.or + (_.not (_.= (_.float +0.0) @temp)) + (_.= (_.string "0") @input) + (_.= (_.string ".0") @input) + (_.= (_.string "0.0") @input)) + (_.return (..some @temp)) + (_.return ..none))))) (def: runtime//f64 Statement - ($_ _.then - @f64//decode - )) + (all _.then + @f64//decode + )) (runtime: (text//index subject param start) (with_vars [idx] - ($_ _.then - (_.set (list idx) (|> subject (_.do "index" (list param start) {.#None}))) - (_.if (_.= _.nil idx) - (_.return ..none) - (_.return (..some idx)))))) + (all _.then + (_.set (list idx) (|> subject (_.do "index" (list param start) {.#None}))) + (_.if (_.= _.nil idx) + (_.return ..none) + (_.return (..some idx)))))) (def: (within? top value) (-> Expression Expression Computation) @@ -553,41 +553,41 @@ (def: runtime//text Statement - ($_ _.then - @text//index - @text//clip - @text//char - )) + (all _.then + @text//index + @text//clip + @text//char + )) (runtime: (array//write idx value array) - ($_ _.then - (_.set (list (_.item idx array)) value) - (_.return array))) + (all _.then + (_.set (list (_.item idx array)) value) + (_.return array))) (def: runtime//array Statement - ($_ _.then - @array//write - )) + (all _.then + @array//write + )) (def: runtime Statement - ($_ _.then - (_.when ..mruby? - ... We're in DragonRuby territory. - (_.statement - (_.do "class_eval" (list) {.#Some [(list (_.local "_")) - (_.statement - (_.alias_method/2 (_.string "remainder") - (_.string "remainder_of_divide")))]} - $Numeric))) - runtime//adt - runtime//lux - runtime//i64 - runtime//f64 - runtime//text - runtime//array - )) + (all _.then + (_.when ..mruby? + ... We're in DragonRuby territory. + (_.statement + (_.do "class_eval" (list) {.#Some [(list (_.local "_")) + (_.statement + (_.alias_method/2 (_.string "remainder") + (_.string "remainder_of_divide")))]} + $Numeric))) + runtime//adt + runtime//lux + runtime//i64 + runtime//f64 + runtime//text + runtime//array + )) (def: .public generate (Operation [Registry Output]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index f40915ce9..143ff325f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -139,10 +139,10 @@ (def: (variant' tag last? value) (-> Expression Expression Expression Computation) - ($_ _.cons/2 - tag - last? - value)) + (all _.cons/2 + tag + last? + value)) (runtime: (sum//make tag last? value) (variant' tag last? value)) @@ -341,9 +341,9 @@ (def: runtime//array Computation - ($_ _.then - @array//write - )) + (all _.then + @array//write + )) (def: runtime Computation diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index 3f5b73842..93ba961d0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -29,7 +29,7 @@ [lux "*" ["@" target] [abstract - monad] + [monad {"+" do}]] [control ["[0]" maybe] ["[0]" exception {"+" exception:}] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index 9ecea955a..888ad1793 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -469,10 +469,10 @@ (n.* 5 (# n.hash hash register)) {#Bit_Fork when then else} - ($_ n.* 7 - (# bit.hash hash when) - (hash then) - (# (maybe.hash (path'_hash super)) hash else)) + (all n.* 7 + (# bit.hash hash when) + (hash then) + (# (maybe.hash (path'_hash super)) hash else)) (^.template [<factor> <tag> <hash>] [{<tag> item} @@ -535,31 +535,31 @@ (def: (hash value) (case value {#Exec this that} - ($_ n.* 2 - (# super hash this) - (# super hash that)) + (all n.* 2 + (# super hash this) + (# super hash that)) {#Let [input register body]} - ($_ n.* 3 - (# super hash input) - (# n.hash hash register) - (# super hash body)) + (all n.* 3 + (# super hash input) + (# n.hash hash register) + (# super hash body)) {#If [test then else]} - ($_ n.* 5 - (# super hash test) - (# super hash then) - (# super hash else)) + (all n.* 5 + (# super hash test) + (# super hash then) + (# super hash else)) {#Get [path record]} - ($_ n.* 7 - (# (list.hash /member.hash) hash path) - (# super hash record)) + (all n.* 7 + (# (list.hash /member.hash) hash path) + (# super hash record)) {#Case [input path]} - ($_ n.* 11 - (# super hash input) - (# (..path'_hash super) hash path)) + (all n.* 11 + (# super hash input) + (# (..path'_hash super) hash path)) ))) (implementation: (loop_equivalence (open "/#[0]")) @@ -588,14 +588,14 @@ (def: (hash value) (case value {#Scope [start inits iteration]} - ($_ n.* 2 - (# n.hash hash start) - (# (list.hash super) hash inits) - (# super hash iteration)) + (all n.* 2 + (# n.hash hash start) + (# (list.hash super) hash inits) + (# super hash iteration)) {#Again resets} - ($_ n.* 3 - (# (list.hash super) hash resets)) + (all n.* 3 + (# (list.hash super) hash resets)) ))) (implementation: (function_equivalence (open "#[0]")) @@ -626,15 +626,15 @@ (def: (hash value) (case value {#Abstraction [environment arity body]} - ($_ n.* 2 - (# (list.hash super) hash environment) - (# n.hash hash arity) - (# super hash body)) + (all n.* 2 + (# (list.hash super) hash environment) + (# n.hash hash arity) + (# super hash body)) {#Apply [abstraction arguments]} - ($_ n.* 3 - (# super hash abstraction) - (# (list.hash super) hash arguments)) + (all n.* 3 + (# super hash abstraction) + (# (list.hash super) hash arguments)) ))) (implementation: (control_equivalence (open "#[0]")) @@ -707,16 +707,16 @@ [#Extension (extension.hash again_hash)]))))) (template: .public (!bind_top register thenP) - [($_ ..path/seq - {..#Bind register} - {..#Pop} - thenP)]) + [(all ..path/seq + {..#Bind register} + {..#Pop} + thenP)]) (template: .public (!multi_pop nextP) - [($_ ..path/seq - {..#Pop} - {..#Pop} - nextP)]) + [(all ..path/seq + {..#Pop} + {..#Pop} + nextP)]) ... TODO: There are sister patterns to the simple side checks for tuples. ... These correspond to the situation where tuple members are accessed @@ -727,10 +727,10 @@ ... and thus will result in useless code being generated. (template [<name> <side>] [(template: .public (<name> idx nextP) - [($_ ..path/seq - (<side> idx) - {..#Pop} - nextP)])] + [(all ..path/seq + (<side> idx) + {..#Pop} + nextP)])] [simple_left_side ..side/left] [simple_right_side ..side/right] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access.lux index bdc53c382..236b46980 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access.lux @@ -28,10 +28,10 @@ (def: .public hash (Hash Access) - ($_ sum.hash - /side.hash - /member.hash - )) + (all sum.hash + /side.hash + /member.hash + )) (def: .public equivalence (Equivalence Access) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/member.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/member.lux index 128f12c26..a01e89668 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/member.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/member.lux @@ -24,10 +24,10 @@ (def: .public hash (Hash Member) - ($_ product.hash - nat.hash - bit.hash - )) + (all product.hash + nat.hash + bit.hash + )) (def: .public equivalence (Equivalence Member) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/side.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/side.lux index a694b7c45..c0be1fea6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/side.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/access/side.lux @@ -24,10 +24,10 @@ (def: .public hash (Hash Side) - ($_ product.hash - nat.hash - bit.hash - )) + (all product.hash + nat.hash + bit.hash + )) (def: .public equivalence (Equivalence Side) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index a2fa63404..5089188ce 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -222,17 +222,17 @@ (def: reader (Parser ..Frozen) - ($_ <>.and - <binary>.nat - <binary>.nat - (<binary>.list (<>.and <binary>.text <binary>.nat)))) + (all <>.and + <binary>.nat + <binary>.nat + (<binary>.list (<>.and <binary>.text <binary>.nat)))) (def: writer (Writer ..Frozen) - ($_ binary.and - binary.nat - binary.nat - (binary.list (binary.and binary.text binary.nat)))) + (all binary.and + binary.nat + binary.nat + (binary.list (binary.and binary.text binary.nat)))) (def: .public (export version archive) (-> Version Archive Binary) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index bfe4e8fa3..2aa066db1 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -25,8 +25,8 @@ (def: .public equivalence (Equivalence Artifact) - ($_ product.equivalence - nat.equivalence - /category.equivalence - bit.equivalence - )) + (all product.equivalence + nat.equivalence + /category.equivalence + bit.equivalence + )) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux index 3f1bf2256..39bc31a5f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact/category.lux @@ -21,14 +21,14 @@ (def: .public definition_equivalence (Equivalence Definition) - ($_ product.equivalence - text.equivalence - (maybe.equivalence ($_ product.equivalence - nat.equivalence - nat.equivalence - nat.equivalence - )) - )) + (all product.equivalence + text.equivalence + (maybe.equivalence (all product.equivalence + nat.equivalence + nat.equivalence + nat.equivalence + )) + )) (type: .public Category (Variant diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux index e798429e1..a03795255 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/descriptor.lux @@ -53,30 +53,30 @@ (def: .public equivalence (Equivalence Descriptor) - ($_ product.equivalence - text.equivalence - text.equivalence - nat.equivalence - ..module_state_equivalence - set.equivalence - )) + (all product.equivalence + text.equivalence + text.equivalence + nat.equivalence + ..module_state_equivalence + set.equivalence + )) (def: .public writer (Writer Descriptor) - ($_ format.and - format.text - format.text - format.nat - format.any - (format.set format.text) - )) + (all format.and + format.text + format.text + format.nat + format.any + (format.set format.text) + )) (def: .public parser (Parser Descriptor) - ($_ <>.and - <binary>.text - <binary>.text - <binary>.nat - (# <>.monad in {.#Cached}) - (<binary>.set text.hash <binary>.text) - )) + (all <>.and + <binary>.text + <binary>.text + <binary>.nat + (# <>.monad in {.#Cached}) + (<binary>.set text.hash <binary>.text) + )) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux index 73214b2ab..4f87f705c 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux @@ -62,9 +62,9 @@ (def: .public (writer content) (All (_ d) (-> (Writer d) (Writer (Document d)))) - (let [writer ($_ binary.and - signature.writer - content)] + (let [writer (all binary.and + signature.writer + content)] (|>> representation writer))) (def: .public (parser key it) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index 26ee6ba8e..ea5245ea7 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -107,15 +107,15 @@ (def: .public writer (Writer Registry) (let [definition (is (Writer //category.Definition) - ($_ binary.and - binary.text - (binary.maybe - ($_ binary.and - binary.nat - binary.nat - binary.nat - )) - )) + (all binary.and + binary.text + (binary.maybe + (all binary.and + binary.nat + binary.nat + binary.nat + )) + )) category (is (Writer Category) (function (_ value) (case value @@ -135,7 +135,7 @@ dependencies (is (Writer (Set unit.ID)) (binary.set dependency)) artifacts (is (Writer (Sequence [Category Bit (Set unit.ID)])) - (binary.sequence_64 ($_ binary.and category mandatory? dependencies)))] + (binary.sequence_64 (all binary.and category mandatory? dependencies)))] (|>> representation (the #artifacts) (sequence#each (function (_ [it dependencies]) @@ -151,15 +151,15 @@ (def: .public parser (Parser Registry) (let [definition (is (Parser //category.Definition) - ($_ <>.and - <binary>.text - (<binary>.maybe - ($_ <>.and - <binary>.nat - <binary>.nat - <binary>.nat - )) - )) + (all <>.and + <binary>.text + (<binary>.maybe + (all <>.and + <binary>.nat + <binary>.nat + <binary>.nat + )) + )) category (is (Parser Category) (do [! <>.monad] [tag <binary>.nat] @@ -181,7 +181,7 @@ (<>.and <binary>.nat <binary>.nat)) dependencies (is (Parser (Set unit.ID)) (<binary>.set unit.hash dependency))] - (|> (<binary>.sequence_64 ($_ <>.and category mandatory? dependencies)) + (|> (<binary>.sequence_64 (all <>.and category mandatory? dependencies)) (# <>.monad each (sequence#mix (function (_ [category mandatory? dependencies] registry) (product.right (case category diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux index 235913727..a9ade8ed9 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/signature.lux @@ -27,9 +27,9 @@ (def: .public equivalence (Equivalence Signature) - ($_ product.equivalence - symbol.equivalence - nat.equivalence)) + (all product.equivalence + symbol.equivalence + nat.equivalence)) (def: .public (description signature) (-> Signature Text) @@ -37,12 +37,12 @@ (def: .public writer (Writer Signature) - ($_ binary.and - (binary.and binary.text binary.text) - binary.nat)) + (all binary.and + (binary.and binary.text binary.text) + binary.nat)) (def: .public parser (Parser Signature) - ($_ <>.and - (<>.and <binary>.text <binary>.text) - <binary>.nat)) + (all <>.and + (<>.and <binary>.text <binary>.text) + <binary>.nat)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux index 460757c42..63221895e 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/unit.lux @@ -24,9 +24,9 @@ (def: .public hash (Hash ID) - ($_ product.hash - nat.hash - nat.hash)) + (all product.hash + nat.hash + nat.hash)) (def: .public equivalence (Equivalence ID) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux index 90bee909d..84b644f47 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/artifact.lux @@ -47,18 +47,18 @@ (^.template [<tag>] [{<tag> left right} - ($_ list#composite - (again left) - (again right))]) + (all list#composite + (again left) + (again right))]) ([synthesis.#Alt] [synthesis.#Seq]) {synthesis.#Bit_Fork when then else} (case else {.#Some else} - ($_ list#composite - (again then) - (again else)) + (all list#composite + (again then) + (again else)) {.#None} (again then)) @@ -106,28 +106,28 @@ {synthesis.#Branch value} (case value {synthesis.#Exec this that} - ($_ list#composite - (references this) - (references that)) + (all list#composite + (references this) + (references that)) {synthesis.#Let input _ body} - ($_ list#composite - (references input) - (references body)) + (all list#composite + (references input) + (references body)) {synthesis.#If test then else} - ($_ list#composite - (references test) - (references then) - (references else)) + (all list#composite + (references test) + (references then) + (references else)) {synthesis.#Get _ record} (references record) {synthesis.#Case input path} - ($_ list#composite - (references input) - (path_references references path))) + (all list#composite + (references input) + (path_references references path))) {synthesis.#Loop value} (case value diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux index 99f7da67a..776ed07be 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux @@ -87,24 +87,24 @@ (def: .public service (Parser Service) (let [compilation (is (Parser Compilation) - ($_ <>.and - (<>.some ..host_dependency_parser) - (<>.some ..library_parser) - (<>.some ..compiler_parser) - (<>.some ..source_parser) - ..target_parser - ..module_parser - (<>.else configuration.empty ..configuration_parser)))] - ($_ <>.or - (<>.after (<cli>.this "build") - compilation) - (<>.after (<cli>.this "repl") - compilation) - (<>.after (<cli>.this "export") - ($_ <>.and - (<>.some ..source_parser) - ..target_parser)) - ))) + (all <>.and + (<>.some ..host_dependency_parser) + (<>.some ..library_parser) + (<>.some ..compiler_parser) + (<>.some ..source_parser) + ..target_parser + ..module_parser + (<>.else configuration.empty ..configuration_parser)))] + (all <>.or + (<>.after (<cli>.this "build") + compilation) + (<>.after (<cli>.this "repl") + compilation) + (<>.after (<cli>.this "export") + (all <>.and + (<>.some ..source_parser) + ..target_parser)) + ))) (def: .public target (-> Service Target) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux index 898e4c5c3..ad3d3f124 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux @@ -25,10 +25,10 @@ (def: .public equivalence (Equivalence Compiler) - ($_ product.equivalence - symbol.equivalence - (list.equivalence text.equivalence) - )) + (all product.equivalence + symbol.equivalence + (list.equivalence text.equivalence) + )) (template [<ascii> <name>] [(def: <name> diff --git a/stdlib/source/library/lux/tool/compiler/meta/export.lux b/stdlib/source/library/lux/tool/compiler/meta/export.lux index 4fdc63159..3d1361d10 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/export.lux @@ -31,10 +31,10 @@ "library.tar") (def: .public mode - ($_ tar.and - tar.read_by_owner tar.write_by_owner - tar.read_by_group tar.write_by_group - tar.read_by_other)) + (all tar.and + tar.read_by_owner tar.write_by_owner + tar.read_by_group tar.write_by_group + tar.read_by_other)) (def: .public ownership tar.Ownership diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index 8b0d5e6f7..37f464b01 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -59,17 +59,17 @@ (def: (module_parser key parser) (All (_ document) (-> (Key document) (Parser document) (Parser (module.Module document)))) - ($_ <>.and - <binary>.nat - descriptor.parser - (document.parser key parser))) + (all <>.and + <binary>.nat + descriptor.parser + (document.parser key parser))) (def: (parser key parser) (All (_ document) (-> (Key document) (Parser document) (Parser [(module.Module document) Registry]))) - ($_ <>.and - (..module_parser key parser) - registry.parser)) + (all <>.and + (..module_parser key parser) + registry.parser)) (def: (fresh_analysis_state host configuration) (-> Target Configuration .Lux) @@ -276,10 +276,10 @@ (..parser $.key $.parser) {.#Item [custom_state custom_key custom_format custom_parser custom_compiler] tail} - ($_ <>.either - (..parser custom_key custom_parser) - (cache_parser tail) - ))) + (all <>.either + (..parser custom_key custom_parser) + (cache_parser tail) + ))) (def: (valid_cache customs fs context import contexts [module_name @module]) (-> (List Custom) (file.System Async) Context Import (List //.Context) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index c7548669a..5c6b6176b 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -78,13 +78,13 @@ (def: mode tar.Mode - ($_ tar.and - tar.read_by_group - tar.read_by_owner - - tar.write_by_other - tar.write_by_group - tar.write_by_owner)) + (all tar.and + tar.read_by_group + tar.read_by_owner + + tar.write_by_other + tar.write_by_group + tar.write_by_owner)) (def: owner tar.Owner diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index f82207ad0..7d3edd65f 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -82,57 +82,57 @@ (-> Type Text) (case type {.#Primitive name params} - ($_ text#composite - "(Primitive " - (text.enclosed' text.double_quote name) - (|> params - (list#each (|>> format (text#composite " "))) - (list#mix (function.flipped text#composite) "")) - ")") + (all text#composite + "(Primitive " + (text.enclosed' text.double_quote name) + (|> params + (list#each (|>> format (text#composite " "))) + (list#mix (function.flipped text#composite) "")) + ")") (^.template [<tag> <open> <close> <flat>] [{<tag> _} - ($_ text#composite <open> - (|> (<flat> type) - (list#each format) - list.reversed - (list.interposed " ") - (list#mix text#composite "")) - <close>)]) + (all text#composite <open> + (|> (<flat> type) + (list#each format) + list.reversed + (list.interposed " ") + (list#mix text#composite "")) + <close>)]) ([.#Sum "(Or " ")" flat_variant] [.#Product "[" "]" flat_tuple]) {.#Function input output} (.let [[ins out] (flat_function type)] - ($_ text#composite "(-> " - (|> ins - (list#each format) - list.reversed - (list.interposed " ") - (list#mix text#composite "")) - " " (format out) ")")) + (all text#composite "(-> " + (|> ins + (list#each format) + list.reversed + (list.interposed " ") + (list#mix text#composite "")) + " " (format out) ")")) {.#Parameter idx} (n#encoded idx) {.#Var id} - ($_ text#composite "-" (n#encoded id)) + (all text#composite "-" (n#encoded id)) {.#Ex id} - ($_ text#composite "+" (n#encoded id)) + (all text#composite "+" (n#encoded id)) {.#Apply param fun} (.let [[type_func type_args] (flat_application type)] - ($_ text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")")) + (all text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")")) (^.template [<tag> <desc>] [{<tag> env body} - ($_ text#composite "(" <desc> " {" (|> env (list#each format) (text.interposed " ")) "} " (format body) ")")]) + (all text#composite "(" <desc> " {" (|> env (list#each format) (text.interposed " ")) "} " (format body) ")")]) ([.#UnivQ "All"] [.#ExQ "Ex"]) {.#Named [module name] type} - ($_ text#composite module "." name) + (all text#composite module "." name) )) ... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction @@ -160,16 +160,16 @@ [.#ExQ]) {.#Parameter idx} - (maybe.else (panic! ($_ text#composite - "Unknown type parameter" text.new_line - " Index: " (n#encoded idx) text.new_line - "Environment: " (|> env - list.enumeration - (list#each (.function (_ [index type]) - ($_ text#composite - (n#encoded index) - " " (..format type)))) - (text.interposed (text#composite text.new_line " "))))) + (maybe.else (panic! (all text#composite + "Unknown type parameter" text.new_line + " Index: " (n#encoded idx) text.new_line + "Environment: " (|> env + list.enumeration + (list#each (.function (_ [index type]) + (all text#composite + (n#encoded index) + " " (..format type)))) + (text.interposed (text#composite text.new_line " "))))) (list.item idx env)) _ @@ -398,16 +398,16 @@ [location meta.location valueT (meta.type valueN) .let [_ ("lux io log" - ($_ text#composite - (symbol#encoded (symbol ..log!)) " " (location.format location) text.new_line - "Expression: " (case valueC - {.#Some valueC} - (code.format valueC) - - {.#None} - (symbol#encoded valueN)) - text.new_line - " Type: " (..format valueT)))]] + (all text#composite + (symbol#encoded (symbol ..log!)) " " (location.format location) text.new_line + "Expression: " (case valueC + {.#Some valueC} + (code.format valueC) + + {.#None} + (symbol#encoded valueN)) + text.new_line + " Type: " (..format valueT)))]] (in (list (code.symbol valueN)))) {.#Right valueC} diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 2b60eb1a4..ec8b13b95 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -201,9 +201,9 @@ (def: representation_definition_name (-> Text Text) - (|>> ($_ text#composite - (symbol#encoded (symbol ..#Representation)) - " "))) + (|>> (all text#composite + (symbol#encoded (symbol ..#Representation)) + " "))) (def: declaration (Parser [Text (List Text)]) @@ -213,11 +213,11 @@ (def: abstract (Parser [Code [Text (List Text)] Code (List Code)]) (|export|.parser - ($_ <>.and - ..declaration - <code>.any - (<>.some <code>.any) - ))) + (all <>.and + ..declaration + <code>.any + (<>.some <code>.any) + ))) ... TODO: Make sure the generated code always gets optimized away. ... (This applies to uses of "abstraction" and "representation") @@ -238,9 +238,9 @@ [(~+ type_varsC)]))) (` (type: (~ representation_declaration) (~ representation_type))) - ($_ list#composite - primitives - (list (` ((~! ..pop!))))))))) + (all list#composite + primitives + (list (` ((~! ..pop!))))))))) (type: (Selection a) (Variant diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 51797be2d..9cd171aaf 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -445,18 +445,18 @@ (All (_ a) (-> Var Type (Check a) (-> Type (Check a)) (Check a))) - ($_ either - (do ..monad - [_ (..bind type id)] - then) - (do [! ..monad] - [ring (..ring id) - _ (..assertion "" (n.> 1 (set.size ring))) - _ (monad.each ! (re_bind type) (set.list ring))] - then) - (do ..monad - [?bound (peek id)] - (else (maybe.else {.#Var id} ?bound))))) + (all either + (do ..monad + [_ (..bind type id)] + then) + (do [! ..monad] + [ring (..ring id) + _ (..assertion "" (n.> 1 (set.size ring))) + _ (monad.each ! (re_bind type) (set.list ring))] + then) + (do ..monad + [?bound (peek id)] + (else (maybe.else {.#Var id} ?bound))))) ... TODO: "link/2" can be optimized... (def: (link/2 left right) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index 5fde46588..26cc9cdb3 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -256,10 +256,10 @@ (def: (provision sig_type compiler context dep) (-> Type Lux Type_Context Type (Check Instance)) (case (meta.result compiler - ($_ meta.either - (do meta.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts)) - (do meta.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)) - (do meta.monad [alts (..imported_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)))) + (all meta.either + (do meta.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts)) + (do meta.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)) + (do meta.monad [alts (..imported_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)))) {.#Left error} (check.failure error) @@ -307,10 +307,10 @@ (def: (alternatives sig_type member_idx input_types output_type) (-> Type Nat (List Type) Type (Meta (List Instance))) (let [test (candidate_alternatives sig_type member_idx input_types output_type)] - ($_ meta.either - (do meta.monad [alts (..local_env sig_type)] (test alts)) - (do meta.monad [alts (..local_structs sig_type)] (test alts)) - (do meta.monad [alts (..imported_structs sig_type)] (test alts))))) + (all meta.either + (do meta.monad [alts (..local_env sig_type)] (test alts)) + (do meta.monad [alts (..local_structs sig_type)] (test alts)) + (do meta.monad [alts (..imported_structs sig_type)] (test alts))))) (def: (var? input) (-> Code Bit) diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux index 1533e2f3b..53145e4e6 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/type/poly.lux @@ -26,9 +26,9 @@ (def: polyP (Parser [Code Text Code]) - (let [private ($_ <>.and - <code>.local - <code>.any)] + (let [private (all <>.and + <code>.local + <code>.any)] (<>.either (<>.and <code>.any private) (<>.and (<>#in (` .private)) private)))) diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index dd8430421..99b3e934c 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -87,9 +87,9 @@ (syntax: .public (unit: [[export_policy type_name unit_name] (|export|.parser - ($_ <>.and - <code>.local - <code>.local))]) + (all <>.and + <code>.local + <code>.local))]) (do meta.monad [@ meta.current_module_name .let [g!type (code.local type_name)]] @@ -116,10 +116,10 @@ (syntax: .public (scale: [[export_policy type_name scale_name ratio] (|export|.parser - ($_ <>.and - <code>.local - <code>.local - ..scaleP))]) + (all <>.and + <code>.local + <code>.local + ..scaleP))]) (do meta.monad [.let [(open "_[0]") ratio] @ meta.current_module_name diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index eca972ca5..6c1331c4d 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" all} ["@" target] ["[0]" ffi {"+" import:}] [abstract @@ -74,11 +74,11 @@ (def: .public all Concern - ($_ ..also - ..creation - ..modification - ..deletion - )) + (.all ..also + ..creation + ..modification + ..deletion + )) ) (type: .public (Watcher !) @@ -246,14 +246,14 @@ (list#composite deletions all_deletions)]) [(list) (list) (list)] changes)]] - (in ($_ list#composite - (list#each (|>> product.left [..creation]) creations) - (|> modifications - (list.only (function (_ [path previous_modification current_modification]) - (not (instant#= previous_modification current_modification)))) - (list#each (|>> product.left [..modification]))) - (list#each (|>> [..deletion]) deletions) - ))))) + (in (.all list#composite + (list#each (|>> product.left [..creation]) creations) + (|> modifications + (list.only (function (_ [path previous_modification current_modification]) + (not (instant#= previous_modification current_modification)))) + (list#each (|>> product.left [..modification]))) + (list#each (|>> [..deletion]) deletions) + ))))) ))) (def: .public (mock separator) @@ -400,17 +400,17 @@ (def: (watch_events concern) (-> Concern (List Watch_Event)) - ($_ list#composite - (if (..creation? concern) - (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE))) - (list)) - (if (..modification? concern) - (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY))) - (list)) - (if (..deletion? concern) - (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE))) - (list)) - )) + (.all list#composite + (if (..creation? concern) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE))) + (list)) + (if (..modification? concern) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY))) + (list)) + (if (..deletion? concern) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE))) + (list)) + )) (def: .public default (IO (Try (Watcher Async))) diff --git a/stdlib/source/library/lux/world/input/keyboard.lux b/stdlib/source/library/lux/world/input/keyboard.lux index e79fafa14..539f875e0 100644 --- a/stdlib/source/library/lux/world/input/keyboard.lux +++ b/stdlib/source/library/lux/world/input/keyboard.lux @@ -1,6 +1,6 @@ (.using - [library - [lux "*"]]) + [library + [lux {"-" left right}]]) (type: .public Key Nat) diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux index ad721f6ea..b3143c56e 100644 --- a/stdlib/source/library/lux/world/net/http/cookie.lux +++ b/stdlib/source/library/lux/world/net/http/cookie.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - [control - [monad {"+" do}] - ["[0]" try {"+" Try}] - ["p" parser ("[1]#[0]" monad) - ["l" text {"+" Parser}]]] - [data - [number - ["i" int]] - [text - ["%" format {"+" format}]] - [format - ["[0]" context {"+" Context}]] - [collection - ["[0]" dictionary]]] - [time - ["[0]" duration {"+" Duration}]]]] - ["[0]" // {"+" Header} - ["[0]" header]]) + [library + [lux "*" + [control + [monad {"+" do}] + ["[0]" try {"+" Try}] + ["p" parser ("[1]#[0]" monad) + ["l" text {"+" Parser}]]] + [data + [number + ["i" int]] + [text + ["%" format {"+" format}]] + [format + ["[0]" context {"+" Context}]] + [collection + ["[0]" dictionary]]] + [time + ["[0]" duration {"+" Duration}]]]] + ["[0]" // {"+" Header} + ["[0]" header]]) (type: .public Directive (-> Text Text)) @@ -78,12 +78,12 @@ (def: (cookies context) (-> Context (Parser Context)) - ($_ p.either - (do p.monad - [context' (..cookie context) - _ (l.this "; ")] - (cookies context')) - (p#in context))) + (all p.either + (do p.monad + [context' (..cookie context) + _ (l.this "; ")] + (cookies context')) + (p#in context))) (def: .public (get header) (-> Text (Try Context)) diff --git a/stdlib/source/library/lux/world/net/http/query.lux b/stdlib/source/library/lux/world/net/http/query.lux index adc83d961..445e28bfe 100644 --- a/stdlib/source/library/lux/world/net/http/query.lux +++ b/stdlib/source/library/lux/world/net/http/query.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - [control - pipe - [monad {"+" do}] - ["[0]" try {"+" Try}] - ["p" parser - ["l" text {"+" Parser}]]] - [data - [number - ["[0]" nat]] - ["[0]" text - ["%" format {"+" format}]] - [format - ["[0]" context {"+" Context}]] - [collection - ["[0]" dictionary]]]]]) + [library + [lux "*" + [control + pipe + [monad {"+" do}] + ["[0]" try {"+" Try}] + ["p" parser + ["l" text {"+" Parser}]]] + [data + [number + ["[0]" nat]] + ["[0]" text + ["%" format {"+" format}]] + [format + ["[0]" context {"+" Context}]] + [collection + ["[0]" dictionary]]]]]) (def: component (Parser Text) @@ -23,42 +23,42 @@ (function (_ component) (do [! p.monad] [head (l.some (l.none_of "+%&;"))] - ($_ p.either - (p.after (p.either l.end - (l.this "&")) - (in head)) - (do ! - [_ (l.this "+") - tail component] - (in (format head " " tail))) - (do ! - [_ (l.this "%") - code (|> (l.exactly 2 l.hexadecimal) - (p.codec nat.hex) - (# ! each text.from_code)) - tail component] - (in (format head code tail)))))))) + (all p.either + (p.after (p.either l.end + (l.this "&")) + (in head)) + (do ! + [_ (l.this "+") + tail component] + (in (format head " " tail))) + (do ! + [_ (l.this "%") + code (|> (l.exactly 2 l.hexadecimal) + (p.codec nat.hex) + (# ! each text.from_code)) + tail component] + (in (format head code tail)))))))) (def: (form context) (-> Context (Parser Context)) - ($_ p.either - (do p.monad - [_ l.end] - (in context)) - (do [! p.monad] - [key (l.some (l.none_of "=&;")) - key (l.local key ..component)] - (p.either (do ! - [_ (l.this "=") - value ..component] - (form (dictionary.has key value context))) - (do ! - [_ ($_ p.or - (l.one_of "&;") - l.end)] - (form (dictionary.has key "" context))))) - ... if invalid form data, just stop parsing... - (# p.monad in context))) + (all p.either + (do p.monad + [_ l.end] + (in context)) + (do [! p.monad] + [key (l.some (l.none_of "=&;")) + key (l.local key ..component)] + (p.either (do ! + [_ (l.this "=") + value ..component] + (form (dictionary.has key value context))) + (do ! + [_ (all p.or + (l.one_of "&;") + l.end)] + (form (dictionary.has key "" context))))) + ... if invalid form data, just stop parsing... + (# p.monad in context))) (def: .public (parameters raw) (-> Text (Try Context)) |