diff options
Diffstat (limited to '')
59 files changed, 358 insertions, 375 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index e9c09dfee..e81beecb2 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -861,8 +861,8 @@ [(def: js "JavaScript") - (for {"JVM" (do jvm stuff) - js (do js stuff)} + (for ["JVM" (do jvm stuff) + js (do js stuff)] (do default stuff))]) (documentation: /.`` diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index ef19810e2..745cca04f 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -27,10 +27,10 @@ (=> [t] []))] [(All (_ a b c) (=> [a b c] [b c a]))] - [(All (_ ___a ___z) - (=> {then (=> ___a ___z) - else (=> ___a ___z)} - ___a [Bit then else] ___z))]) + [(All (_ ,,,0 ,,,1) + (=> [then (=> ,,,0 ,,,1) + else (=> ,,,0 ,,,1)] + ,,,0 [Bit then else] ,,,1))]) (documentation: /.||> "A self-contained sequence of concatenative instructions." diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index c9216cb0c..5d0e64f51 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -38,10 +38,10 @@ (documentation: /.generation: "" [(generation: ("my generation" self phase archive [pass_through <synthesis>.any]) - (for {@.jvm + (for [@.jvm (\ phase.monad each (|>> #jvm.Embedded row.row) - (phase archive pass_through))} + (phase archive pass_through))] (phase archive pass_through)))]) (documentation: /.directive: diff --git a/stdlib/source/documentation/lux/type/poly.lux b/stdlib/source/documentation/lux/type/poly.lux index 8708d3f90..f3d1ef3af 100644 --- a/stdlib/source/documentation/lux/type/poly.lux +++ b/stdlib/source/documentation/lux/type/poly.lux @@ -17,48 +17,6 @@ [\\library ["[0]" /]]) -(documentation: /.derived: - "" - [(type: Variant - (.Variant - (#Bit Bit) - (#Text Text) - (#Frac Frac))) - - (type: Recursive - (Rec Recursive - (.Variant - (#Number Frac) - (#Addition Frac Recursive)))) - - (type: Record - (.Record - [#bit Bit - #frac Frac - #text Text - #maybe (Maybe Frac) - #list (List Frac) - #dictionary (Dictionary Text Frac) - #variant Variant - #tuple [Bit Text Frac] - #recursive Recursive - #date Date - #grams (Qty Gram)])) - - (derived: equivalence - ($equivalence.equivalence - Record)) - - (: (Equivalence Record) - equivalence) - - (derived: codec - ($codec.codec - Record)) - - (: (Codec Json Record) - codec)]) - (documentation: /.code "" [(code env type)]) @@ -67,7 +25,6 @@ (.List $.Module) ($.module /._ "" - [..derived: - ..code + [..code ($.default /.poly:)] [])) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index d10f8d2f5..0872e57c1 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -4868,15 +4868,34 @@ (in_meta (list pick)) (target_pick target options' default))))) +(def: (pairs' tokens) + (-> (List Code) (Maybe (List [Code Code]))) + (if (|> tokens + list\size + (n/% 2) + ("lux i64 =" 0)) + (#Some (pairs tokens)) + #None)) + (macro: .public (for tokens) (do meta_monad [target ..target] (case tokens - (^ (list [_ (#Record options)])) - (target_pick target options #None) + (^ (list [_ (#Tuple options)])) + (case (pairs' options) + (#Some options) + (target_pick target options #None) + + #None + (failure (..wrong_syntax_error (name_of ..for)))) - (^ (list [_ (#Record options)] default)) - (target_pick target options (#Some default)) + (^ (list [_ (#Tuple options)] default)) + (case (pairs' options) + (#Some options) + (target_pick target options (#Some default)) + + #None + (failure (..wrong_syntax_error (name_of ..for)))) _ (failure (..wrong_syntax_error (name_of ..for)))))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index 48598dfa5..f1b2b9344 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -26,10 +26,10 @@ (def: (on fgx fgf) ... TODO: Switch from this version to the one below (in comments) ASAP. - (for {@.old (let [fgf' (\ f_apply on + (for [@.old (let [fgf' (\ f_apply on fgf (\ f_monad in (function (_ gf gx) (\ g_apply on gx gf))))] - (:expected (\ f_apply on (:expected fgx) (:expected fgf'))))} + (:expected (\ f_apply on (:expected fgx) (:expected fgf'))))] (let [fgf' (\ f_apply on fgf (\ f_monad in (function (_ gf gx) (\ g_apply on gx gf))))] diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 24883f901..28a48035f 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -38,8 +38,7 @@ (Parser (List Alias)) (|> (<>.and <code>.local_identifier <code>.any) <>.some - <code>.record - (<>.else (list)))) + <code>.tuple)) (def: top^ (Parser (List Code)) @@ -75,9 +74,12 @@ (meta.failure (format "Cannot expand to more than a single AST/Code node:" text.new_line (|> expansion (list\each %.code) (text.interposed " "))))))) -(syntax: .public (=> [aliases aliases^ - inputs stack^ - outputs stack^]) +(def: signature^ + (Parser [(List Alias) Stack Stack]) + (<>.either ($_ <>.and aliases^ stack^ stack^) + ($_ <>.and (<>\in (list)) stack^ stack^))) + +(syntax: .public (=> [[aliases inputs outputs] signature^]) (let [de_alias (function (_ aliased) (list\mix (function (_ [from to] pre) (code.replaced (code.local_identifier from) to pre)) @@ -248,26 +250,26 @@ ) (def: .public if - (All (_ ___a ___z) - (=> {then (=> ___a ___z) - else (=> ___a ___z)} - ___a [Bit then else] ___z)) + (All (_ ,,,0 ,,,1) + (=> [then (=> ,,,0 ,,,1) + else (=> ,,,0 ,,,1)] + ,,,0 [Bit then else] ,,,1)) (function (_ [[[stack test] then] else]) (.if test (then stack) (else stack)))) (def: .public call - (All (_ ___a ___z) - (=> {quote (=> ___a ___z)} - ___a [quote] ___z)) + (All (_ ,,,0 ,,,1) + (=> [quote (=> ,,,0 ,,,1)] + ,,,0 [quote] ,,,1)) (function (_ [stack quote]) (quote stack))) (def: .public loop - (All (_ ___) - (=> {test (=> ___ ___ [Bit])} - ___ [test] ___)) + (All (_ ,,,) + (=> [test (=> ,,, ,,, [Bit])] + ,,, [test] ,,,)) (function (loop [stack pred]) (let [[stack' verdict] (pred stack)] (.if verdict @@ -275,34 +277,34 @@ stack')))) (def: .public dip - (All (_ ___ a) - (=> ___ [a (=> ___ ___)] - ___ [a])) + (All (_ ,,, a) + (=> ,,, [a (=> ,,, ,,,)] + ,,, [a])) (function (_ [[stack a] quote]) [(quote stack) a])) (def: .public dip/2 - (All (_ ___ a b) - (=> ___ [a b (=> ___ ___)] - ___ [a b])) + (All (_ ,,, a b) + (=> ,,, [a b (=> ,,, ,,,)] + ,,, [a b])) (function (_ [[[stack a] b] quote]) [[(quote stack) a] b])) (def: .public do - (All (_ ___a ___z) - (=> {body (=> ___a ___z) - pred (=> ___z ___a [Bit])} - ___a [pred body] - ___z [pred body])) + (All (_ ,,,0 ,,,1) + (=> [body (=> ,,,0 ,,,1) + pred (=> ,,,1 ,,,0 [Bit])] + ,,,0 [pred body] + ,,,1 [pred body])) (function (_ [[stack pred] body]) [[(body stack) pred] body])) (def: .public while - (All (_ ___a ___z) - (=> {body (=> ___z ___a) - pred (=> ___a ___z [Bit])} - ___a [pred body] - ___z)) + (All (_ ,,,0 ,,,1) + (=> [body (=> ,,,1 ,,,0) + pred (=> ,,,0 ,,,1 [Bit])] + ,,,0 [pred body] + ,,,1)) (function (while [[stack pred] body]) (let [[stack' verdict] (pred stack)] (.if verdict @@ -310,24 +312,24 @@ stack')))) (def: .public compose - (All (_ ___a ___ ___z) - (=> [(=> ___a ___) (=> ___ ___z)] - [(=> ___a ___z)])) + (All (_ ,,,0 ,,, ,,,1) + (=> [(=> ,,,0 ,,,) (=> ,,, ,,,1)] + [(=> ,,,0 ,,,1)])) (function (_ [[stack f] g]) [stack (|>> f g)])) (def: .public partial - (All (_ ___a ___z a) - (=> ___a [a (=> ___a [a] ___z)] - ___a [(=> ___a ___z)])) + (All (_ ,,,0 ,,,1 a) + (=> ,,,0 [a (=> ,,,0 [a] ,,,1)] + ,,,0 [(=> ,,,0 ,,,1)])) (function (_ [[stack arg] quote]) [stack (|>> (push arg) quote)])) (word: .public when - (All (_ ___) - (=> {body (=> ___ ___)} - ___ [Bit body] - ___)) + (All (_ ,,,) + (=> [body (=> ,,, ,,,)] + ,,, [Bit body] + ,,,)) swap (push ..call) (push ..drop) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 6309f4f35..091273281 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -20,57 +20,57 @@ (new [a]) (get [] a) (compareAndSet [a a] boolean)]))] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (as_is))) -(with_expansions [<new> (for {@.js "js array new" +(with_expansions [<new> (for [@.js "js array new" @.python "python array new" @.lua "lua array new" @.ruby "ruby array new" @.php "php array new" - @.scheme "scheme array new"} + @.scheme "scheme array new"] (as_is)) - <write> (for {@.js "js array write" + <write> (for [@.js "js array write" @.python "python array write" @.lua "lua array write" @.ruby "ruby array write" @.php "php array write" - @.scheme "scheme array write"} + @.scheme "scheme array write"] (as_is)) - <read> (for {@.js "js array read" + <read> (for [@.js "js array read" @.python "python array read" @.lua "lua array read" @.ruby "ruby array read" @.php "php array read" - @.scheme "scheme array read"} + @.scheme "scheme array read"] (as_is))] (abstract: .public (Atom a) (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference a)] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (array.Array a))) [(def: .public (atom value) (All (_ a) (-> a (Atom a))) (:abstraction (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::new value)] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (<write> 0 value (<new> 1)))))) (def: .public (read! atom) (All (_ a) (-> (Atom a) (IO a))) (io.io (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::get (:representation atom))] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (<read> 0 (:representation atom)))))) (def: .public (compare_and_swap! current new atom) (All (_ a) (-> a a (Atom a) (IO Bit))) (io.io (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::compareAndSet current new (:representation atom))] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (let [old (<read> 0 (:representation atom))] (if (same? old current) (exec (<write> 0 new (:representation atom)) diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 4e82d76a6..c9430c1ed 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -45,7 +45,7 @@ ["[1]::[0]" (new [int]) (schedule [java/lang/Runnable long java/util/concurrent/TimeUnit] "io" (java/util/concurrent/ScheduledFuture java/lang/Object))]))] - (for {@.old (as_is <jvm>) + (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js @@ -55,7 +55,7 @@ (ffi.import: threading/Timer ["[1]::[0]" (new [ffi.Float ffi.Function]) - (start [] "io" "?" Any)])} + (start [] "io" "?" Any)])] ... Default (type: Thread @@ -70,18 +70,18 @@ (with_expansions [<jvm> (|> (java/lang/Runtime::getRuntime) (java/lang/Runtime::availableProcessors) .nat)] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] ... Default 1))) (with_expansions [<jvm> (as_is (def: runner java/util/concurrent/ScheduledThreadPoolExecutor (java/util/concurrent/ScheduledThreadPoolExecutor::new (.int ..parallelism))))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (as_is) - @.python (as_is)} + @.python (as_is)] ... Default (def: runner @@ -111,7 +111,7 @@ 0 (java/util/concurrent/Executor::execute runnable runner) _ (java/util/concurrent/ScheduledThreadPoolExecutor::schedule runnable (.int milli_seconds) java/util/concurrent/TimeUnit::MILLISECONDS runner))))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js @@ -124,7 +124,7 @@ [(|> milli_seconds n.frac (f./ +1,000.0))] threading/Timer::new (threading/Timer::start []))] - (in []))} + (in []))] ... Default (do [! io.monad] @@ -135,10 +135,10 @@ ..runner)] (in []))))) -(for {@.old (as_is) +(for [@.old (as_is) @.jvm (as_is) @.js (as_is) - @.python (as_is)} + @.python (as_is)] ... Default (as_is (exception: .public cannot_continue_running_threads) diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index b2945a7a0..ec49d9a1a 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -30,7 +30,7 @@ (def: .public (read! box) (All (_ ! a) (-> (Box ! a) (Thread ! a))) (function (_ !) - (for {@.old + (for [@.old ("jvm aaload" (:representation box) 0) @.jvm @@ -46,7 +46,7 @@ @.lua ("lua array read" 0 (:representation box)) @.ruby ("ruby array read" 0 (:representation box)) @.php ("php array read" 0 (:representation box)) - @.scheme ("scheme array read" 0 (:representation box))}))) + @.scheme ("scheme array read" 0 (:representation box))]))) (def: .public (write! value box) (All (_ a) (-> a (All (_ !) (-> (Box ! a) (Thread ! Any))))) diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index cabc9268c..0805da036 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -62,9 +62,9 @@ (def: (conjoint MlMla) (do monad - [[l1 Mla] (for {@.old + [[l1 Mla] (for [@.old (: ((:parameter 1) (Writer (:parameter 0) ((:parameter 1) (Writer (:parameter 0) (:parameter 2))))) - MlMla)} + MlMla)] ... On new compiler MlMla) [l2 a] Mla] diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index 8d1975b8f..33bac997b 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -60,12 +60,12 @@ (def: byte (-> (I64 Any) (primitive "java.lang.Byte")) - (for {@.old + (for [@.old (|>> .int ffi.long_to_byte) @.jvm - (|>> .int (:as (primitive "java.lang.Long")) ffi.long_to_byte)})))] - (for {@.old (as_is <jvm>) + (|>> .int (:as (primitive "java.lang.Long")) ffi.long_to_byte)])))] + (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js @@ -92,14 +92,14 @@ (ffi.import: (make-bytevector [Nat] Binary)) (ffi.import: (bytevector-u8-ref [Binary Nat] I64)) (ffi.import: (bytevector-u8-set! [Binary Nat (I64 Any)] Any)) - (ffi.import: (bytevector-length [Binary] Nat)))} + (ffi.import: (bytevector-length [Binary] Nat)))] ... Default (type: .public Binary (array.Array (I64 Any))))) (template: (!size binary) - [(for {@.old (ffi.length binary) + [(for [@.old (ffi.length binary) @.jvm (ffi.length binary) @.js @@ -113,13 +113,13 @@ "python array length") @.scheme - (..bytevector-length [binary])} + (..bytevector-length [binary])] ... Default (array.size binary))]) (template: (!read index binary) - [(for {@.old (..i64 (ffi.read! index binary)) + [(for [@.old (..i64 (ffi.read! index binary)) @.jvm (..i64 (ffi.read! index binary)) @.js @@ -136,7 +136,7 @@ ("python array read" index)) @.scheme - (..bytevector-u8-ref [binary index])} + (..bytevector-u8-ref [binary index])] ... Default (|> binary @@ -152,13 +152,13 @@ (:as ..Binary))]) (template: (!write index value binary) - [(for {@.old (ffi.write! index (..byte value) binary) + [(for [@.old (ffi.write! index (..byte value) binary) @.jvm (ffi.write! index (..byte value) binary) @.js (!!write .Frac n.frac "js array write" index value binary) @.python (!!write (I64 Any) (:as (I64 Any)) "python array write" index value binary) @.scheme (exec (..bytevector-u8-set! [binary index value]) - binary)} + binary)] ... Default (array.write! index (|> value .nat (n.% (hex "100"))) binary))]) @@ -169,7 +169,7 @@ (def: .public (empty size) (-> Nat Binary) - (for {@.old (ffi.array byte size) + (for [@.old (ffi.array byte size) @.jvm (ffi.array byte size) @.js @@ -181,7 +181,7 @@ (:as Binary)) @.scheme - (..make-bytevector size)} + (..make-bytevector size)] ... Default (array.empty size))) @@ -261,7 +261,7 @@ (def: .public (write/64! index value binary) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 7 index)) - (for {@.scheme (let [write_high (|>> (!write index (i64.right_shifted 56 value)) + (for [@.scheme (let [write_high (|>> (!write index (i64.right_shifted 56 value)) (!write (n.+ 1 index) (i64.right_shifted 48 value)) (!write (n.+ 2 index) (i64.right_shifted 40 value)) (!write (n.+ 3 index) (i64.right_shifted 32 value))) @@ -269,7 +269,7 @@ (!write (n.+ 5 index) (i64.right_shifted 16 value)) (!write (n.+ 6 index) (i64.right_shifted 8 value)) (!write (n.+ 7 index) value))] - (|> binary write_high write_low #try.Success))} + (|> binary write_high write_low #try.Success))] (#try.Success (|> binary (!write index (i64.right_shifted 56 value)) (!write (n.+ 1 index) (i64.right_shifted 48 value)) @@ -286,8 +286,8 @@ (def: (= reference sample) (with_expansions [<jvm> (java/util/Arrays::equals reference sample)] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (let [limit (!size reference)] (and (n.= limit (!size sample)) @@ -298,8 +298,8 @@ (recur (++ index))) true)))))))) -(for {@.old (as_is) - @.jvm (as_is)} +(for [@.old (as_is) + @.jvm (as_is)] ... Default (exception: .public (cannot_copy_bytes [bytes Nat @@ -315,8 +315,8 @@ (with_expansions [<jvm> (as_is (do try.monad [_ (java/lang/System::arraycopy source (.int source_offset) target (.int target_offset) (.int bytes))] (in target)))] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] ... Default (let [source_input (n.- source_offset (!size source)) @@ -338,8 +338,8 @@ (if (n.> size limit) (exception.except ..slice_out_of_bounds [size offset length]) (with_expansions [<jvm> (as_is (#try.Success (java/util/Arrays::copyOfRange binary (.int offset) (.int limit))))] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] ... Default (..copy length offset binary 0 (..empty length))))))) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 3c04a7d7f..0bd99245d 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -27,17 +27,17 @@ (with_expansions [<index_type> (primitive "java.lang.Long") <elem_type> (primitive "java.lang.Object") <array_type> (type (Array <elem_type>))] - (for {@.jvm + (for [@.jvm (template: (!int value) [(|> value (:as <index_type>) "jvm object cast" - "jvm conversion long-to-int")])} + "jvm conversion long-to-int")])] (as_is)) (def: .public (empty size) (All (_ a) (-> Nat (Array a))) - (for {@.old + (for [@.old (:expected ("jvm anewarray" "(java.lang.Object )" size)) @.jvm @@ -52,11 +52,11 @@ @.lua ("lua array new" size) @.ruby ("ruby array new" size) @.php ("php array new" size) - @.scheme ("scheme array new" size)})) + @.scheme ("scheme array new" size)])) (def: .public (size array) (All (_ a) (-> (Array a) Nat)) - (for {@.old + (for [@.old ("jvm arraylength" array) @.jvm @@ -73,7 +73,7 @@ @.lua ("lua array length" array) @.ruby ("ruby array length" array) @.php ("php array length" array) - @.scheme ("scheme array length" array)})) + @.scheme ("scheme array length" array)])) (template: (!read! <read!> <null?>) [(let [output (<read!> index array)] @@ -85,7 +85,7 @@ (All (_ a) (-> Nat (Array a) (Maybe a))) (if (n.< (size array) index) - (for {@.old + (for [@.old (let [value ("jvm aaload" array index)] (if ("jvm object null?" value) #.None @@ -104,13 +104,13 @@ @.lua (!read! "lua array read" "lua object nil?") @.ruby (!read! "ruby array read" "ruby object nil?") @.php (!read! "php array read" "php object null?") - @.scheme (!read! "scheme array read" "scheme object nil?")}) + @.scheme (!read! "scheme array read" "scheme object nil?")]) #.None)) (def: .public (write! index value array) (All (_ a) (-> Nat a (Array a) (Array a))) - (for {@.old + (for [@.old ("jvm aastore" array index value) @.jvm @@ -124,13 +124,13 @@ @.lua ("lua array write" index value array) @.ruby ("ruby array write" index value array) @.php ("php array write" index value array) - @.scheme ("scheme array write" index value array)})) + @.scheme ("scheme array write" index value array)])) (def: .public (delete! index array) (All (_ a) (-> Nat (Array a) (Array a))) (if (n.< (size array) index) - (for {@.old + (for [@.old (write! index (:expected ("jvm object null")) array) @.jvm @@ -141,7 +141,7 @@ @.lua ("lua array delete" index array) @.ruby ("ruby array delete" index array) @.php ("php array delete" index array) - @.scheme ("scheme array delete" index array)}) + @.scheme ("scheme array delete" index array)]) array)) ) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index ead69db05..286290c96 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -203,7 +203,7 @@ (def: .public (all check xs) (All (_ a b) (-> (-> a (Maybe b)) (List a) (List b))) - (for {... TODO: Stop relying on this ASAP. + (for [... TODO: Stop relying on this ASAP. @.js (mix (function (_ head tail) (case (check head) @@ -213,7 +213,7 @@ #.None tail)) #.End - (reversed xs))} + (reversed xs))] (case xs #.End #.End @@ -572,9 +572,9 @@ (do [! monad] [lMla MlMla ... TODO: Remove this version ASAP and use one below. - lla (for {@.old + lla (for [@.old (: ((:parameter 0) (List (List (:parameter 1)))) - (monad.all ! lMla))} + (monad.all ! lMla))] (monad.all ! lMla))] (in (..together lla))))) diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 5080c4c1c..728a67ce4 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -224,9 +224,9 @@ ... If so, a brand-new root must be established, that is ... 1-level taller. (|> row - (with@ #root (|> (for {@.old + (with@ #root (|> (for [@.old (: (Hierarchy (:parameter 0)) - (empty_hierarchy []))} + (empty_hierarchy []))] (empty_hierarchy [])) (array.write! 0 (#Hierarchy (value@ #root row))) (array.write! 1 (..path (value@ #level row) (value@ #tail row))))) @@ -293,9 +293,9 @@ (#try.Success (if (n.< (tail_off row_size) idx) (revised@ #root (hierarchy\has (value@ #level row) idx val) row) - (revised@ #tail (for {@.old + (revised@ #tail (for [@.old (: (-> (Base (:parameter 0)) (Base (:parameter 0))) - (|>> array.clone (array.write! (branch_idx idx) val)))} + (|>> array.clone (array.write! (branch_idx idx) val)))] (|>> array.clone (array.write! (branch_idx idx) val))) row))) (exception.except ..index_out_of_bounds [row idx])))) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 36b162843..ee7daa341 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -103,13 +103,13 @@ (do maybe.monad [family (value@ #family zipper)] (in (let [(^slots [#parent #lefts #rights]) family] - (for {@.old + (for [@.old (revised@ #node (: (-> (Tree (:parameter 0)) (Tree (:parameter 0))) (with@ #//.children (list\composite (list.reversed lefts) (#.Item (value@ #node zipper) rights)))) - parent)} + parent)] (with@ [#node #//.children] (list\composite (list.reversed lefts) (#.Item (value@ #node zipper) @@ -123,11 +123,11 @@ (#.Some family) (case (value@ <side> family) (#.Item next side') - (#.Some (for {@.old + (#.Some (for [@.old [#family (#.Some (|> family (with@ <side> side') (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))) - #node next]} + #node next]] (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ side' zipper) (|>> (with@ <side> side') @@ -153,11 +153,11 @@ #.None (#.Item last prevs) - (#.Some (for {@.old [#family (#.Some (|> family + (#.Some (for [@.old [#family (#.Some (|> family (with@ <side> #.End) (revised@ <op_side> (|>> (#.Item (value@ #node zipper)) (list\composite prevs))))) - #node last]} + #node last]] (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ prevs zipper) (|>> (with@ <side> #.End) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index aadcb9dbe..b3961edc4 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -184,7 +184,7 @@ (def: .public (replaced pattern replacement template) (-> Text Text Text Text) - (for {@.old + (for [@.old (:as Text ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" (:as (primitive "java.lang.String") template) @@ -214,7 +214,7 @@ ... TODO @.scheme ... TODO @.common_lisp ... TODO @.r - } + ] ... Inefficient default (loop [left "" right template] @@ -253,7 +253,7 @@ (def: &equivalence ..equivalence) (def: (hash input) - (for {@.old + (for [@.old (|> input (: (primitive "java.lang.String")) "jvm invokevirtual:java.lang.String:hashCode:" @@ -267,7 +267,7 @@ "jvm conversion int-to-long" "jvm object cast" (: (primitive "java.lang.Long")) - (:as Nat))} + (:as Nat))] ... Platform-independent default. (let [length ("lux text size" input)] (loop [index 0 @@ -323,7 +323,7 @@ (def: .public (lower_cased value) (-> Text Text) - (for {@.old + (for [@.old (:as Text ("jvm invokevirtual:java.lang.String:toLowerCase:" (:as (primitive "java.lang.String") value))) @@ -342,11 +342,11 @@ ("lua apply" ("lua constant" "string.lower") value)) @.ruby (:as Text - ("ruby object do" "downcase" value))})) + ("ruby object do" "downcase" value))])) (def: .public (upper_cased value) (-> Text Text) - (for {@.old + (for [@.old (:as Text ("jvm invokevirtual:java.lang.String:toUpperCase:" (:as (primitive "java.lang.String") value))) @@ -365,4 +365,4 @@ ("lua apply" ("lua constant" "string.upper") value)) @.ruby (:as Text - ("ruby object do" "upcase" value))})) + ("ruby object do" "upcase" value))])) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index af3341930..b8955f732 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -34,7 +34,7 @@ ["[1]::[0]" (new [int]) (toString [] java/lang/String)]))] - (`` (for {@.old (as_is <jvm>) + (`` (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js (as_is (import: (JS_Array a) ["[1]::[0]" @@ -44,24 +44,24 @@ ...https://www.lua.org/manual/5.3/manual.html#pdf-table.concat (import: (table/insert [(array.Array Text) Text] "?" Nothing)) ... https://www.lua.org/manual/5.3/manual.html#pdf-table.insert - )} + )] (as_is)))) (`` (abstract: .public Buffer - (for {@.old [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] + (for [@.old [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.jvm [Nat (-> java/lang/StringBuilder java/lang/StringBuilder)] @.js [Nat (-> (JS_Array Text) (JS_Array Text))] - @.lua [Nat (-> (array.Array Text) (array.Array Text))]} + @.lua [Nat (-> (array.Array Text) (array.Array Text))]] ... default (Row Text)) [(def: .public empty Buffer (:abstraction (with_expansions [<jvm> [0 function.identity]] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js [0 function.identity] - @.lua [0 function.identity]} + @.lua [0 function.identity]] ... default row.empty)))) @@ -76,7 +76,7 @@ builder)))] (:abstraction [(n.+ (//.size chunk) capacity) (|>> transform (then! chunk))]))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (let [[capacity transform] (:representation buffer) then! (: (-> (JS_Array Text) (JS_Array Text)) @@ -93,17 +93,17 @@ (table/insert [array chunk]) array)))] (:abstraction [(n.+ (//.size chunk) capacity) - (|>> transform then!)]))} + (|>> transform then!)]))] ... default (|> buffer :representation (row.suffix chunk) :abstraction)))) (def: .public size (-> Buffer Nat) (with_expansions [<jvm> (|>> :representation product.left)] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js <jvm> - @.lua <jvm>} + @.lua <jvm>] ... default (|>> :representation (row\mix (function (_ chunk total) @@ -116,7 +116,7 @@ (|> (java/lang/StringBuilder::new (.int capacity)) transform java/lang/StringBuilder::toString))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (let [[capacity transform] (:representation buffer)] (|> (array.empty 0) @@ -124,7 +124,7 @@ transform (JS_Array::join [""]))) @.lua (let [[capacity transform] (:representation buffer)] - (table/concat [(transform (array.empty 0)) ""]))} + (table/concat [(transform (array.empty 0)) ""]))] ... default (row\mix (function (_ chunk total) (format total chunk)) diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index 19867bae4..817288316 100644 --- a/stdlib/source/library/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux @@ -15,7 +15,7 @@ ["[1]::[0]" (new [[byte] java/lang/String]) (getBytes [java/lang/String] [byte])]))] - (for {@.old (as_is <jvm>) + (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js @@ -59,12 +59,12 @@ @.scheme ... https://srfi.schemers.org/srfi-140/srfi-140.html (as_is (ffi.import: (string->utf8 [Text] Binary)) - (ffi.import: (utf8->string [Binary] Text)))} + (ffi.import: (utf8->string [Binary] Text)))] (as_is))) (def: (encoded value) (-> Text Binary) - (for {@.old + (for [@.old (java/lang/String::getBytes (//.name //.utf_8) ... TODO: Remove coercion below. ... The coercion below may seem @@ -109,12 +109,12 @@ (:as Binary)) @.scheme - (..string->utf8 value)})) + (..string->utf8 value)])) (def: (decoded value) (-> Binary (Try Text)) (with_expansions [<jvm> (#try.Success (java/lang/String::new value (//.name //.utf_8)))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js @@ -155,7 +155,7 @@ @.scheme (|> value ..utf8->string - #try.Success)}))) + #try.Success)]))) (implementation: .public codec (Codec Binary Text) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 8ce5e58e7..8f3245ea2 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -66,7 +66,7 @@ (intValue [] int) (longValue [] long) (doubleValue [] double)]))] - (for {@.old (as_is <jvm>) + (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js @@ -114,24 +114,24 @@ (import: (car [.Any] .Any)) (import: (cdr [.Any] .Any)) (import: (format [Text .Any] Text))) - })) + ])) (def: Inspector (.type (Format Any))) -(for {@.lua (def: (tuple_array tuple) +(for [@.lua (def: (tuple_array tuple) (-> (array.Array Any) (array.Array Any)) (array.of_list (loop [idx 0] (let [member ("lua array read" idx tuple)] (if ("lua object nil?" member) #.End - (#.Item member (recur (++ idx))))))))} + (#.Item member (recur (++ idx))))))))] (as_is)) (def: (tuple_inspection inspection) (-> Inspector Inspector) - (with_expansions [<adaption> (for {@.lua (~~ (as_is ..tuple_array))} + (with_expansions [<adaption> (for [@.lua (~~ (as_is ..tuple_array))] (~~ (as_is)))] (`` (|>> (:as (array.Array Any)) <adaption> @@ -175,7 +175,7 @@ (tuple_inspection inspection value))) #.None) (java/lang/Object::toString object))))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js @@ -374,7 +374,7 @@ ... else (..format ["~s" value]) )) - }))) + ]))) (exception: .public (cannot_represent_value [type Type]) (exception.report diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index b81ca5c50..d6c85234d 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -18,7 +18,7 @@ [tau +6.28318530717958647692] ) -(for {@.old +(for [@.old (as_is (template [<name> <method>] [(def: .public (<name> it) (-> Frac Frac) @@ -282,7 +282,7 @@ (def: .public root/3 (-> Frac Frac) (..pow ("lux f64 /" +3.0 +1.0)))) - }) + ]) (def: .public (round it) (-> Frac Frac) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index 00e75d32c..7b81afa69 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -35,10 +35,10 @@ (let [initialization+event_loop (` ((~! do) (~! io.monad) [(~ g!output) (~ body) - (~+ (for {@.old (list) + (~+ (for [@.old (list) @.jvm (list) @.js (list) - @.python (list)} + @.python (list)] (list g!_ (` (~! thread.run!)))))] ((~' in) (~ g!output))))] (in (list (` ("lux def program" diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index ef1076787..d1e9b2122 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -71,13 +71,13 @@ (Equivalence java/lang/Float) (def: (= parameter subject) - (for {@.old + (for [@.old ("jvm feq" parameter subject) @.jvm ("jvm float =" ("jvm object cast" parameter) - ("jvm object cast" subject))}))) + ("jvm object cast" subject))]))) (import: java/lang/Double ["[1]::[0]" diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index fe2bba2e6..1d5eda342 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -102,11 +102,11 @@ (def: .public (memory library) (-> Library java/lang/ClassLoader) - (with_expansions [<cast> (for {@.old + (with_expansions [<cast> (for [@.old (<|) @.jvm - "jvm object cast"})] + "jvm object cast"])] (<| <cast> (object [] java/lang/ClassLoader [] [] diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 4988e4d78..af0514a76 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -31,19 +31,19 @@ (-> Text Text) (text.enclosed ["(" ")"])) -(for {@.old (as_is (ffi.import: java/lang/CharSequence) +(for [@.old (as_is (ffi.import: java/lang/CharSequence) (ffi.import: java/lang/String ["[1]::[0]" - (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))} + (replace [java/lang/CharSequence java/lang/CharSequence] java/lang/String)]))] (as_is)) (def: nested (-> Text Text) (.let [nested_new_line (format text.new_line text.tab)] - (for {@.old (|>> (format text.new_line) + (for [@.old (|>> (format text.new_line) (:as java/lang/String) (java/lang/String::replace (:as java/lang/CharSequence text.new_line) - (:as java/lang/CharSequence nested_new_line)))} + (:as java/lang/CharSequence nested_new_line)))] (|>> (format text.new_line) (text.replaced text.new_line nested_new_line))))) diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index 696b204b0..57063a5a0 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -152,7 +152,7 @@ (def: .public now (IO Instant) - (io (..of_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") + (io (..of_millis (for [@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) ("jvm object cast") (: (primitive "java.lang.Long")) @@ -189,7 +189,7 @@ "common_lisp apply" (:as Int) (i.* +1,000)) - })))) + ])))) (template [<field> <type> <post_processing>] [(def: .public (<field> instant) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index be5d7df27..d24ad8f33 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -101,11 +101,11 @@ (ioW.write system static module_id artifact_id content)))] (do [! ..monad] [_ (ioW.prepare system static module_id) - _ (for {@.python (|> output + _ (for [@.python (|> output row.list (list.sub 128) (monad.each ! (monad.each ! write_artifact!)) - (: (Action (List (List Any)))))} + (: (Action (List (List Any)))))] (|> output row.list (monad.each ..monad write_artifact!) 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 f5f47f98d..66b58bf74 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 @@ -199,7 +199,7 @@ [.let [inputT (type.tuple (list.repeated arity Any))] abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) - _ (analysis/type.infer (for {@.js ffi.Function} + _ (analysis/type.infer (for [@.js ffi.Function] Any))] (in (#analysis.Extension extension (list (analysis.nat arity) abstractionA)))))])) 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 dd7d43516..f7ed4ed54 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 @@ -29,15 +29,15 @@ ["[0]" phase]]]]]]) (def: Nil - (for {@.lua ffi.Nil} + (for [@.lua ffi.Nil] Any)) (def: Object - (for {@.lua (type (ffi.Object Any))} + (for [@.lua (type (ffi.Object Any))] Any)) (def: Function - (for {@.lua ffi.Function} + (for [@.lua ffi.Function] Any)) (def: array::new 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 227bc4539..a52f8bb53 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 @@ -108,15 +108,15 @@ ))) (def: Null - (for {@.php ffi.Null} + (for [@.php ffi.Null] Any)) (def: Object - (for {@.php (type (ffi.Object Any))} + (for [@.php (type (ffi.Object Any))] Any)) (def: Function - (for {@.php ffi.Function} + (for [@.php ffi.Function] Any)) (def: object::new 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 2f07f677b..700f80163 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 @@ -108,20 +108,23 @@ ))) (def: None - (for {@.python - ffi.None} + (for [@.python + ffi.None] Any)) (def: Object - (for {@.python (type (ffi.Object Any))} + (for [@.python + (type (ffi.Object Any))] Any)) (def: Function - (for {@.python ffi.Function} + (for [@.python + ffi.Function] Any)) (def: Dict - (for {@.python ffi.Dict} + (for [@.python + ffi.Dict] Any)) (def: object::get 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 d267ca612..6bf24f1fa 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 @@ -108,15 +108,15 @@ ))) (def: Nil - (for {@.ruby ffi.Nil} + (for [@.ruby ffi.Nil] Any)) (def: Object - (for {@.ruby (type (ffi.Object Any))} + (for [@.ruby (type (ffi.Object Any))] Any)) (def: Function - (for {@.ruby ffi.Function} + (for [@.ruby ffi.Function] Any)) (def: object::get 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 688803a33..2075522d7 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 @@ -108,12 +108,12 @@ ))) (def: Nil - (for {@.scheme - ffi.Nil} + (for [@.scheme + ffi.Nil] Any)) (def: Function - (for {@.scheme ffi.Function} + (for [@.scheme ffi.Function] Any)) (def: bundle::object 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 e71de0758..1be1bcfa5 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 @@ -211,7 +211,7 @@ (/.install "index" (trinary ..text//index)) (/.install "size" (unary //runtime.text//size)) ... TODO: Use version below once the Lua compiler becomes self-hosted. - ... (/.install "size" (unary (for {@.lua (!unary "utf8.len")} + ... (/.install "size" (unary (for [@.lua (!unary "utf8.len")] ... (!unary "string.len")))) (/.install "char" (binary ..text//char)) (/.install "clip" (trinary ..text//clip)) 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 d2b823b85..9ed2c2624 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 @@ -342,7 +342,7 @@ (..char_index subject) ..lux_index)))))] (with_vars [byte_index] - (for {@.lua <normal>} + (for [@.lua <normal>] (_.if ..on_rembulan? <rembulan> <normal>))))) @@ -356,7 +356,7 @@ ... (_.+ (_.int +1)) (..byte_index text) (_.- (_.int +1)))))] - (for {@.lua <normal>} + (for [@.lua <normal>] (_.if ..on_rembulan? <rembulan> <normal>)))) @@ -364,7 +364,7 @@ (runtime: (text//size subject) (with_expansions [<rembulan> (_.return (_.apply/1 (_.var "string.len") subject)) <normal> (_.return (_.apply/1 (_.var "utf8.len") subject))] - (for {@.lua <normal>} + (for [@.lua <normal>] (_.if ..on_rembulan? <rembulan> <normal>)))) @@ -383,7 +383,7 @@ (_.if (_.= _.nil offset) (_.statement (_.error/1 (_.string "[Lux Error] Cannot get char from text."))) (_.return (_.apply/2 (_.var "utf8.codepoint") text offset)))))] - (for {@.lua <normal>} + (for [@.lua <normal>] (_.if ..on_rembulan? <rembulan> <normal>)))) 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 bfdf279fa..16283e2e9 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 @@ -291,7 +291,7 @@ [(_.> ..i64::+limit) ..i64::+iteration ..i64::+cap ..i64::-limit] [(_.< ..i64::-limit) ..i64::-iteration ..i64::-cap ..i64::+limit] )) - (_.return (for {@.python input} + (_.return (for [@.python input] ... This +- is only necessary to guarantee that values within the limits are always longs in Python 2 (|> input (_.+ ..i64::+limit) (_.- ..i64::+limit)))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux index b256823f5..4913559a1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -18,23 +18,23 @@ ... This universe constant is for languages where one can't just turn all compiled definitions ... into the local variables of some scoping function. (def: .public universe - (for {... In the case of Lua, there is a limit of 200 locals in a function's scope. + (for [ ... In the case of Lua, there is a limit of 200 locals in a function's scope. @.lua (not ("lua script universe")) ... Cannot make all definitions be local variables because of limitations with JRuby. @.ruby (not ("ruby script universe")) ... Cannot make all definitions be local variables because of limitations with PHP itself. @.php (not ("php script universe")) ... Cannot make all definitions be local variables because of limitations with Kawa. - @.scheme (not ("scheme script universe"))} + @.scheme (not ("scheme script universe"))] #0)) (def: universe_label Text (with_expansions [<label> (format "u" (%.nat (if ..universe 1 0)))] - (for {@.lua <label> + (for [@.lua <label> @.ruby <label> @.php <label> - @.scheme <label>} + @.scheme <label>] ""))) (def: .public (artifact [module artifact]) 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 3df8bb802..bd1aca3b3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -51,7 +51,7 @@ ["[0]" frac]]]]]) (template: (inline: <declaration> <type> <body>) - [(for {@.python (def: <declaration> <type> <body>)} + [(for [@.python (def: <declaration> <type> <body>)] (template: <declaration> [<body>]))]) ... TODO: Implement "lux syntax char case!" as a custom extension. diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index effdf2251..7c347bd0e 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -179,7 +179,8 @@ (Equivalence Type) (def: (= x y) - (or (for {@.php false} ... TODO: Remove this once JPHP is gone. + (or (for [... TODO: Remove this once JPHP is gone. + @.php false] (same? x y)) (case [x y] [(#.Primitive xname xparams) (#.Primitive yname yparams)] diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 51bb8d13e..bf8210953 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -557,7 +557,8 @@ ... Type-check to ensure that the 'expected' type subsumes the 'actual' type. (def: (check' assumptions expected actual) (Checker Type) - (if (for {@.php false} ... TODO: Remove this once JPHP is gone. + (if (for [... TODO: Remove this once JPHP is gone. + @.php false] (same? expected actual)) (check\in assumptions) (with ..type_check_failed [expected actual] diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index a31de2fdc..e3d156adf 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -94,8 +94,8 @@ (def: close (|>> (exception.except ..cannot_close) in)))))))))] - (for {@.old (as_is <jvm>) - @.jvm (as_is <jvm>)} + (for [@.old (as_is <jvm>) + @.jvm (as_is <jvm>)] (as_is))) (def: .public (write_line message console) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 9cbb0f8e4..66c125a34 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -297,7 +297,7 @@ java/io/File::new (java/io/File::renameTo (java/io/File::new destination)))) )))] - (for {@.old (as_is <for_jvm>) + (for [@.old (as_is <for_jvm>) @.jvm (as_is <for_jvm>) @.js @@ -983,7 +983,7 @@ ... ..default_separator) ... )) ... ) - } + ] (as_is))) (def: .public (exists? monad fs path) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index d26778c03..3af235af1 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -456,6 +456,6 @@ (async.future (..default_poll watcher))) ))))) )] - (for {@.old (as_is <jvm>) - @.jvm (as_is <jvm>)} + (for [@.old (as_is <jvm>) + @.jvm (as_is <jvm>)] (as_is))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index a2ec857a0..c5af6d11f 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -213,8 +213,8 @@ (in [(.nat status) [#//.headers headers #//.body (..default_body input)]]))))))] - (for {@.old (as_is <jvm>) - @.jvm (as_is <jvm>)} + (for [@.old (as_is <jvm>) + @.jvm (as_is <jvm>)] (as_is))) (implementation: .public (async client) diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 3203a12b1..feb95fff9 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -141,7 +141,7 @@ (jvm\\consume iterator)) #.End)) )] - (for {@.old (as_is <jvm>) + (for [@.old (as_is <jvm>) @.jvm (as_is <jvm>) @.js (as_is (def: default_exit! (-> Exit (IO Nothing)) @@ -299,7 +299,7 @@ ... (ffi.import: (cdr [Pair] Text)) ... (ffi.import: (car "as" head [PList] Pair)) ... (ffi.import: (cdr "as" tail [PList] PList))) - } + ] (as_is))) (implementation: .public default @@ -310,7 +310,7 @@ java/util/Map::keySet java/util/Set::iterator ..jvm\\consume))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (io.io (if ffi.on_node_js? (case (ffi.constant Object [process env]) @@ -345,7 +345,7 @@ ... (let [entry (..head input)] ... (recur (..tail input) ... (dictionary.has (..car entry) (..cdr entry) output)))))) - }))) + ]))) (def: (variable name) (template.let [(!fetch <method>) @@ -358,7 +358,7 @@ #.None (exception.except ..unknown_environment_variable [name]))))]] (with_expansions [<jvm> (!fetch java/lang/System::resolveEnv)] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (io.io (if ffi.on_node_js? (case (do maybe.monad @@ -374,13 +374,13 @@ @.python (!fetch os/environ::get) @.lua (!fetch os/getenv) @.ruby (!fetch RubyEnv::fetch) - })))) + ])))) (def: home (io.run! (with_expansions [<default> (io.io "~") <jvm> (io.io (maybe.else "" (java/lang/System::getProperty "user.home")))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (if ffi.on_node_js? (|> (..require [] "os") @@ -395,7 +395,7 @@ ... (in (if (bit\= false (:as Bit output)) ... "~" ... output))) - } + ] ... TODO: Replace dummy implementation. <default>)))) @@ -403,7 +403,7 @@ (io.run! (with_expansions [<default> "." <jvm> (io.io (maybe.else "" (java/lang/System::getProperty "user.dir")))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (if ffi.on_node_js? (case (ffi.constant ..NodeJs_Process [process]) @@ -426,7 +426,7 @@ ... (in (if (bit\= false (:as Bit output)) ... "." ... output))) - } + ] ... TODO: Replace dummy implementation. (io.io <default>))))) @@ -434,7 +434,7 @@ (with_expansions [<jvm> (do io.monad [_ (java/lang/System::exit code)] (in (undefined)))] - (for {@.old <jvm> + (for [@.old <jvm> @.jvm <jvm> @.js (cond ffi.on_node_js? (..exit_node_js! code) @@ -449,4 +449,4 @@ @.ruby (RubyKernel::exit [code]) ... @.php (..exit [code]) ... @.scheme (..exit [code]) - })))) + ])))) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 07a9b3f3f..5c0fdfbc7 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -306,8 +306,8 @@ process (java/lang/ProcessBuilder::start builder)] (..default_process process)))) )] - (for {@.old (as_is <jvm>) - @.jvm (as_is <jvm>)} + (for [@.old (as_is <jvm>) + @.jvm (as_is <jvm>)] (as_is))) (type: .public (Mock s) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 3bb2fb687..ce54d9d9a 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -87,10 +87,10 @@ (case ?actual (#try.Success actual) (in (do [! try.monad] - [output (\ ! each (for {@.old (|>> (:as java/lang/String) + [output (\ ! each (for [@.old (|>> (:as java/lang/String) java/lang/String::trim (:as Text)) - @.jvm (|>> java/lang/String::trim)}) + @.jvm (|>> java/lang/String::trim)]) (\ utf8.codec decoded actual)) actual (|> output (text.all_split_by " ") diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 48e296847..b36d73070 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -155,9 +155,9 @@ _ (ioW.freeze (value@ #platform.&file_system platform) static archive) program_context (async\in ($/program.context archive)) host_dependencies (..load_host_dependencies (value@ #platform.&file_system platform) compilation_host_dependencies) - _ (..package! (for {@.old (file.async file.default) + _ (..package! (for [@.old (file.async file.default) @.jvm (file.async file.default) - @.js file.default}) + @.js file.default]) host_dependencies packager,package static diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 238bf666d..d40709cf6 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -1,5 +1,5 @@ -(.with_expansions [<target>' (.for {"{old}" (.as_is ["[1]/[0]" jvm]) - "JVM" (.as_is ["[1]/[0]" jvm])} +(.with_expansions [<target>' (.for ["{old}" (.as_is ["[1]/[0]" jvm]) + "JVM" (.as_is ["[1]/[0]" jvm])] (.as_is)) <target> <target>'] (.module: @@ -78,10 +78,10 @@ (def: sub_tests Test (with_expansions [... TODO: Update & expand tests for this - <target> (for {@.jvm (~~ (as_is /target/jvm.test)) - @.old (~~ (as_is /target/jvm.test))} + <target> (for [@.jvm (~~ (as_is /target/jvm.test)) + @.old (~~ (as_is /target/jvm.test))] (~~ (as_is))) - <extension> (for {@.old (~~ (as_is))} + <extension> (for [@.old (~~ (as_is))] (~~ (as_is /extension.test)))] (`` (_.in_parallel (list /abstract.test /control.test @@ -443,7 +443,7 @@ (#.Right [lux (list)])))] (do random.monad [expected random.nat] - (with_expansions [<found_crosshair?> (for {@.old (~~ (as_is))} + (with_expansions [<found_crosshair?> (for [@.old (~~ (as_is))] (_.cover [/.Source] (..found_crosshair?)))] (`` ($_ _.and @@ -807,16 +807,16 @@ (~~ (/.comment dummy)))))) (_.cover [/.for] (and (n.= expected - (/.for {"fake host" dummy} + (/.for ["fake host" dummy] expected)) (n.= expected - (/.for {@.old expected + (/.for [@.old expected @.jvm expected @.js expected @.python expected @.lua expected @.ruby expected - @.php expected} + @.php expected] dummy)))) ))) @@ -1109,7 +1109,7 @@ (bit\= /.private /.local))) )) -(for {@.old (as_is)} +(for [@.old (as_is)] (as_is (syntax: (for_bindings|test [fn/0 <code>.local_identifier var/0 <code>.local_identifier let/0 <code>.local_identifier @@ -1193,7 +1193,7 @@ Test (<| (_.covering /._) (with_expansions - [<for_bindings> (for {@.old (~~ (as_is))} + [<for_bindings> (for [@.old (~~ (as_is))] (~~ (as_is ..for_bindings)))] (`` ($_ _.and ..for_bit @@ -1224,12 +1224,12 @@ ))))) (program: args - (let [times (for {@.old 100 + (let [times (for [@.old 100 @.jvm 100 @.js 10 @.python 1 @.lua 1 - @.ruby 1} + @.ruby 1] 100)] (<| io.io _.run! diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 0709aff61..2194854b5 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -46,8 +46,8 @@ false)))))) (def: delay - (for {@.js - (i64.left_shifted 4 1)} + (for [@.js + (i64.left_shifted 4 1)] (i64.left_shifted 3 1))) (def: .public test diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 50b35b437..6f87f0889 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -30,8 +30,8 @@ ["[0]" /]]) (def: delay - (for {@.js - (i64.left_shifted 4 1)} + (for [@.js + (i64.left_shifted 4 1)] (i64.left_shifted 3 1))) (def: semaphore diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 155df06fc..fbd5a9b12 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -245,7 +245,7 @@ bar random.nat baz random.bit] (_.cover [/.here] - (with_expansions [<no_parameters> (for {@.js (~~ (as_is))} + (with_expansions [<no_parameters> (for [@.js (~~ (as_is))] (~~ (as_is (/.here))))] (`` (exec <no_parameters> diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 983ac2c3d..52994d6a1 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -51,8 +51,8 @@ (def: my_directive "my directive") ... Generation -(for {@.old - (as_is)} +(for [@.old + (as_is)] (as_is ... Analysis @@ -83,9 +83,9 @@ (\ ! each (|>> (#synthesis.Extension self)))))) (generation: (..my_generation self phase archive [pass_through <synthesis>.any]) - (for {@.jvm + (for [@.jvm (\ phase.monad each (|>> #jvm.Embedded row.row) - (phase archive pass_through))} + (phase archive pass_through))] (phase archive pass_through))) (analysis: (..dummy_generation self phase archive []) @@ -96,7 +96,7 @@ (generation: (..dummy_generation self phase archive []) (\ phase.monad in - (for {@.jvm + (for [@.jvm (row.row (#jvm.Constant (#jvm.LDC (#jvm.String self)))) @.js (js.string self) @@ -104,7 +104,7 @@ @.lua (lua.string self) @.ruby (ruby.string self) @.php (php.string self) - @.scheme (scheme.string self)}))) + @.scheme (scheme.string self)]))) ... Directive (directive: (..my_directive self phase archive [parameters (<>.some <code>.any)]) @@ -123,16 +123,16 @@ (`` ($_ _.and (~~ (template [<macro> <extension>] [(_.cover [<macro>] - (for {@.old - false} + (for [@.old + false] (n.= expected (`` ((~~ (static <extension>)) expected)))))] [/.analysis: ..my_analysis] [/.synthesis: ..my_synthesis])) (_.cover [/.generation:] - (for {@.old - false} + (for [@.old + false] (and (n.= expected (`` ((~~ (static ..my_generation)) expected))) (text\= ..dummy_generation diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index df89b033a..459edd275 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -122,8 +122,8 @@ ["[1]::[0]" ("static" doubleToRawLongBits [double] long) ("static" longBitsToDouble [long] double)]))] - (for {@.old (as_is <jvm>) - @.jvm (as_is <jvm>)} + (for [@.old (as_is <jvm>) + @.jvm (as_is <jvm>)] (as_is))) (def: .public test @@ -210,8 +210,8 @@ (and (/.not_a_number? expected) (/.not_a_number? actual)))))) )] - (for {@.old <jvm> - @.jvm <jvm>} + (for [@.old <jvm> + @.jvm <jvm>] (let [test (: (-> Frac Bit) (function (_ expected) (let [actual (|> expected /.bits /.of_bits)] diff --git a/stdlib/source/test/lux/static.lux b/stdlib/source/test/lux/static.lux index cc63a2913..048d0511b 100644 --- a/stdlib/source/test/lux/static.lux +++ b/stdlib/source/test/lux/static.lux @@ -22,7 +22,7 @@ (def: .public test Test (<| (_.covering /._) - (for {@.old (_.test "PLACEHOLDER" true)} + (for [@.old (_.test "PLACEHOLDER" true)] (_.for [meta.eval] (`` ($_ _.and (~~ (template [<static> <random> <=> <+> <tag>] diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 190c2f65e..9fa008544 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -308,10 +308,10 @@ (do [! random.monad] [expected (\ ! each (i64.and (i64.mask <bits>)) random.nat)] (<| (_.lifted <message>) - (..bytecode (for {@.old + (..bytecode (for [@.old (|>> (:as <type>) <to_long> ("jvm leq" expected)) @.jvm - (|>> (:as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))})) + (|>> (:as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))])) (do /.monad [_ (<push> (|> expected .int <signed> try.trusted))] <wrap>))))] @@ -324,13 +324,13 @@ [(template: (<name> <old_extension> <new_extension>) [(: (-> <type> <type> <type>) (function (_ parameter subject) - (for {@.old + (for [@.old (<old_extension> subject parameter) @.jvm ("jvm object cast" (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject)))})))])] + ("jvm object cast" subject)))])))])] [int/2 java/lang/Integer] [long/2 java/lang/Long] @@ -341,23 +341,23 @@ (template: (int+long/2 <old_extension> <new_extension>) [(: (-> java/lang/Integer java/lang/Long java/lang/Long) (function (_ parameter subject) - (for {@.old + (for [@.old (<old_extension> subject parameter) @.jvm ("jvm object cast" (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject)))})))]) + ("jvm object cast" subject)))])))]) (def: int Test (let [int (: (-> java/lang/Integer (Bytecode Any) (Random Bit)) (function (_ expected bytecode) - (<| (..bytecode (for {@.old + (<| (..bytecode (for [@.old (|>> (:as java/lang/Integer) ("jvm ieq" expected)) @.jvm - (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" expected)))})) + (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" expected)))])) (do /.monad [_ bytecode] ..$Integer::wrap)))) @@ -434,11 +434,11 @@ Test (let [long (: (-> java/lang/Long (Bytecode Any) (Random Bit)) (function (_ expected bytecode) - (<| (..bytecode (for {@.old + (<| (..bytecode (for [@.old (|>> (:as Int) (i.= expected)) @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected)))})) + (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected)))])) (do /.monad [_ bytecode] ..$Long::wrap)))) @@ -507,11 +507,11 @@ ... (i.< (:as Int reference) (:as Int subject)) (:as java/lang/Long -1))]] - (<| (..bytecode (for {@.old + (<| (..bytecode (for [@.old (|>> (:as Int) (i.= expected)) @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected)))})) + (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected)))])) (do /.monad [_ (..$Long::literal subject) _ (..$Long::literal reference) @@ -533,7 +533,7 @@ Test (let [float (: (-> java/lang/Float (Bytecode Any) (Random Bit)) (function (_ expected bytecode) - (<| (..bytecode (for {@.old + (<| (..bytecode (for [@.old (function (_ actual) (or (|> actual (:as java/lang/Float) ("jvm feq" expected)) (and (f.not_a_number? (:as Frac (ffi.float_to_double expected))) @@ -543,7 +543,7 @@ (function (_ actual) (or (|> actual (:as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" expected))) (and (f.not_a_number? (:as Frac (ffi.float_to_double expected))) - (f.not_a_number? (:as Frac (ffi.float_to_double (:as java/lang/Float actual)))))))})) + (f.not_a_number? (:as Frac (ffi.float_to_double (:as java/lang/Float actual)))))))])) (do /.monad [_ bytecode] ..$Float::wrap)))) @@ -595,11 +595,11 @@ ..$Float::random)] reference valid_float subject valid_float - .let [expected (if (for {@.old + .let [expected (if (for [@.old ("jvm feq" reference subject) @.jvm - ("jvm float =" ("jvm object cast" reference) ("jvm object cast" subject))}) + ("jvm float =" ("jvm object cast" reference) ("jvm object cast" subject))]) +0 (if (standard reference subject) +1 @@ -613,11 +613,11 @@ ..$Long::wrap))))) comparison_standard (: (-> java/lang/Float java/lang/Float Bit) (function (_ reference subject) - (for {@.old + (for [@.old ("jvm fgt" subject reference) @.jvm - ("jvm float <" ("jvm object cast" subject) ("jvm object cast" reference))}))) + ("jvm float <" ("jvm object cast" subject) ("jvm object cast" reference))]))) comparison ($_ _.and (_.lifted "FCMPL" (comparison /.fcmpl comparison_standard)) (_.lifted "FCMPG" (comparison /.fcmpg comparison_standard)))] @@ -634,7 +634,7 @@ Test (let [double (: (-> java/lang/Double (Bytecode Any) (Random Bit)) (function (_ expected bytecode) - (<| (..bytecode (for {@.old + (<| (..bytecode (for [@.old (function (_ actual) (or (|> actual (:as java/lang/Double) ("jvm deq" expected)) (and (f.not_a_number? (:as Frac expected)) @@ -644,7 +644,7 @@ (function (_ actual) (or (|> actual (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))) (and (f.not_a_number? (:as Frac expected)) - (f.not_a_number? (:as Frac actual)))))})) + (f.not_a_number? (:as Frac actual)))))])) (do /.monad [_ bytecode] ..$Double::wrap)))) @@ -689,11 +689,11 @@ (do random.monad [reference ..valid_double subject ..valid_double - .let [expected (if (for {@.old + .let [expected (if (for [@.old ("jvm deq" reference subject) @.jvm - ("jvm double =" ("jvm object cast" reference) ("jvm object cast" subject))}) + ("jvm double =" ("jvm object cast" reference) ("jvm object cast" subject))]) +0 (if (standard reference subject) +1 @@ -708,11 +708,11 @@ ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.dcmp_op comparison_standard (: (-> java/lang/Double java/lang/Double Bit) (function (_ reference subject) - (for {@.old + (for [@.old ("jvm dgt" subject reference) @.jvm - ("jvm double <" ("jvm object cast" subject) ("jvm object cast" reference))}))) + ("jvm double <" ("jvm object cast" subject) ("jvm object cast" reference))]))) comparison ($_ _.and (_.lifted "DCMPL" (comparison /.dcmpl comparison_standard)) (_.lifted "DCMPG" (comparison /.dcmpg comparison_standard)))] @@ -790,11 +790,11 @@ (do random.monad [expected (random.only (|>> (:as Frac) f.not_a_number? not) ..$Double::random)]) - (..bytecode (for {@.old + (..bytecode (for [@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))})) + (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))])) (do /.monad [_ (/.double expected)] (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)])))) @@ -811,11 +811,11 @@ (do random.monad [expected (random.only (|>> (:as Frac) f.not_a_number? not) ..$Double::random)]) - (..bytecode (for {@.old + (..bytecode (for [@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))})) + (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))])) (do /.monad [_ (/.new ..$Double) _ /.dup @@ -839,12 +839,12 @@ part0 ..$Long::random part1 ..$Long::random .let [expected (: java/lang/Long - (for {@.old + (for [@.old ("jvm ladd" part0 part1) @.jvm ("jvm object cast" - ("jvm long +" ("jvm object cast" part0) ("jvm object cast" part1)))})) + ("jvm long +" ("jvm object cast" part0) ("jvm object cast" part1)))])) $Self (/type.class class_name (list)) class_field "class_field" object_field "object_field" @@ -958,59 +958,59 @@ (_.context "byte" (array (/.newarray /instruction.t_byte) $Byte::random $Byte::literal [/.bastore /.baload $Byte::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected)))))})))) + (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected)))))])))) (_.context "short" (array (/.newarray /instruction.t_short) $Short::random $Short::literal [/.sastore /.saload $Short::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected)))))})))) + (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected)))))])))) (_.context "int" (array (/.newarray /instruction.t_int) $Integer::random $Integer::literal [/.iastore /.iaload $Integer::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Integer) ("jvm ieq" (:as java/lang/Integer expected))) @.jvm - (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (:as java/lang/Integer expected))))})))) + (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (:as java/lang/Integer expected))))])))) (_.context "long" (array (/.newarray /instruction.t_long) $Long::random $Long::literal [/.lastore /.laload $Long::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Long) ("jvm leq" expected)) @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))})))) + (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))])))) (_.context "float" (array (/.newarray /instruction.t_float) ..valid_float $Float::literal [/.fastore /.faload $Float::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Float) ("jvm feq" expected)) @.jvm - (|>> (:as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (:as java/lang/Float expected))))})))) + (|>> (:as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (:as java/lang/Float expected))))])))) (_.context "double" (array (/.newarray /instruction.t_double) ..valid_double $Double::literal [/.dastore /.daload $Double::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (:as java/lang/Double expected))))})))) + (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (:as java/lang/Double expected))))])))) (_.context "char" (array (/.newarray /instruction.t_char) $Character::random $Character::literal [/.castore /.caload $Character::wrap] (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Character) ("jvm ceq" expected)) @.jvm - (|>> (:as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (:as java/lang/Character expected))))})))) + (|>> (:as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (:as java/lang/Character expected))))])))) (_.context "object" (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop] (function (_ expected) (|>> (:as Text) (text\= (:as Text expected)))))) @@ -1040,11 +1040,11 @@ (template: (!::= <type> <old> <new>) [(: (-> <type> Any Bit) (function (_ expected) - (for {@.old + (for [@.old (|>> (:as <type>) (<old> expected)) @.jvm - (|>> (:as <type>) "jvm object cast" (<new> ("jvm object cast" (:as <type> expected))))})))]) + (|>> (:as <type>) "jvm object cast" (<new> ("jvm object cast" (:as <type> expected))))])))]) (def: conversion Test @@ -1071,20 +1071,20 @@ (_.lifted "I2D" (conversion ..$Integer::primitive ..$Double::primitive /.i2d (|>> ffi.int_to_double) double::=)) (_.lifted "I2B" (conversion ..$Integer::primitive ..$Byte::primitive /.i2b (|>> ffi.int_to_byte) (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected)))))})))) + (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected)))))])))) (_.lifted "I2C" (conversion ..$Integer::primitive ..$Character::primitive /.i2c (|>> ffi.int_to_char) (!::= java/lang/Character "jvm ceq" "jvm char ="))) (_.lifted "I2S" (conversion ..$Integer::primitive ..$Short::primitive /.i2s (|>> ffi.int_to_short) (function (_ expected) - (for {@.old + (for [@.old (|>> (:as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected)))))})))))) + (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected)))))])))))) (<| (_.context "long") ($_ _.and (_.lifted "L2I" (conversion ..$Long::primitive ..$Integer::primitive /.l2i (|>> ffi.long_to_int) int::=)) @@ -1156,7 +1156,7 @@ increment (\ ! each (|>> (n.% 100) /unsigned.u1 try.trusted) random.nat) .let [expected (: java/lang/Long - (for {@.old + (for [@.old ("jvm ladd" (ffi.byte_to_long base) (.int (/unsigned.value increment))) @@ -1165,7 +1165,7 @@ ("jvm object cast" ("jvm long +" ("jvm object cast" (ffi.byte_to_long base)) - ("jvm object cast" (:as java/lang/Long (/unsigned.value increment)))))}))]] + ("jvm object cast" (:as java/lang/Long (/unsigned.value increment)))))]))]] (..bytecode (|>> (:as Int) (i.= (:as Int expected))) (do /.monad [_ (..$Byte::literal base) @@ -1416,11 +1416,11 @@ reference ..$Integer::random subject (|> ..$Integer::random (random.only (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) - .let [[lesser greater] (if (for {@.old + .let [[lesser greater] (if (for [@.old ("jvm ilt" reference subject) @.jvm - ("jvm int <" ("jvm object cast" subject) ("jvm object cast" reference))}) + ("jvm int <" ("jvm object cast" subject) ("jvm object cast" reference))]) [reference subject] [subject reference]) int_comparison ($_ _.and diff --git a/stdlib/source/test/lux/type/poly/equivalence.lux b/stdlib/source/test/lux/type/poly/equivalence.lux index 5bfb8e39d..63854e535 100644 --- a/stdlib/source/test/lux/type/poly/equivalence.lux +++ b/stdlib/source/test/lux/type/poly/equivalence.lux @@ -76,7 +76,7 @@ (random.unicode size)) gen_recursive))) -(for {@.old (as_is)} +(for [@.old (as_is)] (as_is (def: equivalence (Equivalence ..Record) (/.equivalence ..Record)))) @@ -85,5 +85,5 @@ Test (<| (_.covering /._) (_.for [/.equivalence] - (for {@.old (_.test "PLACEHOLDER" true)} + (for [@.old (_.test "PLACEHOLDER" true)] ($equivalence.spec ..equivalence ..random))))) diff --git a/stdlib/source/test/lux/type/poly/functor.lux b/stdlib/source/test/lux/type/poly/functor.lux index d9892b02c..4aec871cf 100644 --- a/stdlib/source/test/lux/type/poly/functor.lux +++ b/stdlib/source/test/lux/type/poly/functor.lux @@ -14,7 +14,7 @@ [data ["[0]" identity]]]]) -(for {@.old (as_is)} +(for [@.old (as_is)] (as_is (def: maybe_functor (Functor .Maybe) (/.functor .Maybe)) diff --git a/stdlib/source/test/lux/type/poly/json.lux b/stdlib/source/test/lux/type/poly/json.lux index 259a25b95..0f78aa976 100644 --- a/stdlib/source/test/lux/type/poly/json.lux +++ b/stdlib/source/test/lux/type/poly/json.lux @@ -108,7 +108,7 @@ ..qty ))) -(for {@.old (as_is)} +(for [@.old (as_is)] (as_is (def: equivalence (Equivalence Record) (poly/equivalence.equivalence Record)) @@ -121,5 +121,5 @@ Test (<| (_.covering /._) (_.for [/.codec] - (for {@.old (_.test "PLACEHOLDER" true)} + (for [@.old (_.test "PLACEHOLDER" true)] ($codec.spec ..equivalence ..codec ..gen_record))))) |