diff options
author | Eduardo Julian | 2017-10-11 18:57:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-11 18:57:44 -0400 |
commit | 74a835634fc9ee5457f3cc7109af069dad9f2d2f (patch) | |
tree | dec444467ecde32ac165627f782f315ac41567e8 /new-luxc/source/luxc/generator/procedure | |
parent | ccabfc6a5e41650788199cb8fd5d87731f094bcd (diff) |
- Migrated new-luxc to latest version of stdlib.
- Some refactoring.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/generator/procedure.jvm.lux | 12 | ||||
-rw-r--r-- | new-luxc/source/luxc/generator/procedure/common.jvm.lux | 64 |
2 files changed, 38 insertions, 38 deletions
diff --git a/new-luxc/source/luxc/generator/procedure.jvm.lux b/new-luxc/source/luxc/generator/procedure.jvm.lux index 77828c952..524513eb5 100644 --- a/new-luxc/source/luxc/generator/procedure.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure.jvm.lux @@ -2,8 +2,8 @@ (;module: lux (lux (control [monad #+ do]) - (data text/format - [maybe] + (data [maybe] + text/format (coll ["d" dict]))) (luxc ["&" base] (lang ["ls" synthesis]) @@ -13,7 +13,7 @@ (def: #export (generate-procedure generate name args) (-> (-> ls;Synthesis (Lux $;Inst)) Text (List ls;Synthesis) (Lux $;Inst)) - (default (&;fail (format "Unknown procedure: " (%t name))) - (do maybe;Monad<Maybe> - [proc (d;get name &&common;procedures)] - (wrap (proc generate args))))) + (<| (maybe;default (&;fail (format "Unknown procedure: " (%t name)))) + (do maybe;Monad<Maybe> + [proc (d;get name &&common;procedures)] + (wrap (proc generate args))))) diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux index 9f8afdbb2..ffbe69708 100644 --- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux @@ -3,9 +3,9 @@ (lux (control [monad #+ do]) (data [text] text/format - (coll [list "L/" Functor<List> Monoid<List>] - ["D" dict])) - [macro #+ Monad<Lux> with-gensyms] + (coll [list "list/" Functor<List>] + [dict #+ Dict])) + [macro #+ with-gensyms] (macro [code] ["s" syntax #+ syntax:]) [host]) @@ -41,7 +41,7 @@ (-> Generator (List ls;Synthesis) (Lux $;Inst))) (type: Bundle - (D;Dict Text Proc)) + (Dict Text Proc)) (syntax: (Vector [size s;nat] elemT) (wrap (list (` [(~@ (list;repeat size elemT))])))) @@ -61,7 +61,7 @@ (def: (install name unnamed) (-> Text (-> Text Proc) (-> Bundle Bundle)) - (D;put name (unnamed name))) + (dict;put name (unnamed name))) (def: (wrong-amount-error proc expected actual) (-> Text Nat Nat Text) @@ -82,8 +82,8 @@ (^ (list (~@ g!input+))) (do macro;Monad<Lux> [(~@ (|> g!input+ - (L/map (function [g!input] - (list g!input (` ((~ g!generate) (~ g!input)))))) + (list/map (function [g!input] + (list g!input (` ((~ g!generate) (~ g!input)))))) list;concat))] ((~' wrap) ((~ g!proc) [(~@ g!input+)]))) @@ -527,13 +527,13 @@ ## [Bundles] (def: lux-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "lux is" (binary lux//is)) (install "lux try" (unary lux//try)))) (def: bit-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "bit count" (unary bit//count)) (install "bit and" (binary bit//and)) (install "bit or" (binary bit//or)) @@ -545,7 +545,7 @@ (def: nat-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "nat +" (binary nat//add)) (install "nat -" (binary nat//sub)) (install "nat *" (binary nat//mul)) @@ -560,7 +560,7 @@ (def: int-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "int +" (binary int//add)) (install "int -" (binary int//sub)) (install "int *" (binary int//mul)) @@ -575,7 +575,7 @@ (def: deg-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "deg +" (binary deg//add)) (install "deg -" (binary deg//sub)) (install "deg *" (binary deg//mul)) @@ -591,7 +591,7 @@ (def: frac-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "frac +" (binary frac//add)) (install "frac -" (binary frac//sub)) (install "frac *" (binary frac//mul)) @@ -612,7 +612,7 @@ (def: text-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "text =" (binary text//eq)) (install "text <" (binary text//lt)) (install "text append" (binary text//append)) @@ -626,7 +626,7 @@ (def: array-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "array new" (unary array//new)) (install "array get" (binary array//get)) (install "array put" (trinary array//put)) @@ -636,7 +636,7 @@ (def: math-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "math cos" (unary math//cos)) (install "math sin" (unary math//sin)) (install "math tan" (unary math//tan)) @@ -659,7 +659,7 @@ (def: io-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "io log" (unary io//log)) (install "io error" (unary io//error)) (install "io exit" (unary io//exit)) @@ -667,14 +667,14 @@ (def: atom-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "atom new" (unary atom//new)) (install "atom read" (unary atom//read)) (install "atom compare-and-swap" (trinary atom//compare-and-swap)))) (def: process-procs Bundle - (|> (D;new text;Hash<Text>) + (|> (dict;new text;Hash<Text>) (install "process concurrency-level" (nullary process//concurrency-level)) (install "process future" (unary process//future)) (install "process schedule" (binary process//schedule)) @@ -682,17 +682,17 @@ (def: #export procedures Bundle - (|> (D;new text;Hash<Text>) - (D;merge lux-procs) - (D;merge bit-procs) - (D;merge nat-procs) - (D;merge int-procs) - (D;merge deg-procs) - (D;merge frac-procs) - (D;merge text-procs) - (D;merge array-procs) - (D;merge math-procs) - (D;merge io-procs) - (D;merge atom-procs) - (D;merge process-procs) + (|> (dict;new text;Hash<Text>) + (dict;merge lux-procs) + (dict;merge bit-procs) + (dict;merge nat-procs) + (dict;merge int-procs) + (dict;merge deg-procs) + (dict;merge frac-procs) + (dict;merge text-procs) + (dict;merge array-procs) + (dict;merge math-procs) + (dict;merge io-procs) + (dict;merge atom-procs) + (dict;merge process-procs) )) |