diff options
Diffstat (limited to 'stdlib')
63 files changed, 579 insertions, 301 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 4f6a134a4..9365e0cda 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -4145,13 +4145,13 @@ temp)) ))) -(def: (zip2 xs ys) +(def: (zip/2 xs ys) (All [a b] (-> (List a) (List b) (List [a b]))) (case xs (#Cons x xs') (case ys (#Cons y ys') - (list& [x y] (zip2 xs' ys')) + (list& [x y] (zip/2 xs' ys')) _ (list)) @@ -4248,7 +4248,7 @@ #None (wrap enhanced-target)))) target - (zip2 locals members))] + (zip/2 locals members))] (wrap (` ({(~ pattern) (~ enhanced-target)} (~ (identifier$ source))))))))) name tags&members body)] (wrap (list full-body))))) @@ -4278,18 +4278,18 @@ _ (fail "Wrong syntax for cond")))) -(def: (enumerate' idx xs) +(def: (enumeration' idx xs) (All [a] (-> Nat (List a) (List [Nat a]))) (case xs (#Cons x xs') - (#Cons [idx x] (enumerate' ("lux i64 +" 1 idx) xs')) + (#Cons [idx x] (enumeration' ("lux i64 +" 1 idx) xs')) #Nil #Nil)) -(def: (enumerate xs) +(def: (enumeration xs) (All [a] (-> (List a) (List [Nat a]))) - (enumerate' 0 xs)) + (enumeration' 0 xs)) (macro: #export (get@ tokens) {#.doc (text$ ($_ "lux text concat" @@ -4318,7 +4318,7 @@ (if ("lux i64 =" idx r-idx) g!output g!_)])) - (zip2 tags (enumerate members))))] + (zip/2 tags (enumeration members))))] (return (list (` ({(~ pattern) (~ g!output)} (~ record)))))) _ @@ -4347,7 +4347,7 @@ g!_ (gensym "g!_") #let [g!output (local-identifier$ short) pattern (|> tags - enumerate + enumeration (list@map (function (_ [tag-idx tag]) (if ("lux i64 =" my-tag-index tag-idx) g!output @@ -4361,7 +4361,7 @@ (: (-> [Nat Name Type] (Meta (List Code))) (function (_ [sub-tag-index sname stype]) (open-field alias tags' sub-tag-index sname source+ stype))) - (enumerate (zip2 tags' members')))] + (enumeration (zip/2 tags' members')))] (return (list@join decls'))) _ @@ -4396,7 +4396,7 @@ [decls' (monad@map meta-monad (: (-> [Nat Name Type] (Meta (List Code))) (function (_ [tag-index sname stype]) (open-field alias tags tag-index sname source stype))) - (enumerate (zip2 tags members)))] + (enumeration (zip/2 tags members)))] (return (list@join decls'))) _ @@ -4632,7 +4632,7 @@ (do meta-monad [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) - (zip2 tags (enumerate members)))] + (zip/2 tags (enumeration members)))] (let [pattern (record$ (list@map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) @@ -4661,7 +4661,7 @@ (: (-> Code (Meta Code)) (function (_ _) (gensym "temp"))) slots) - #let [pairs (zip2 slots bindings) + #let [pairs (zip/2 slots bindings) update-expr (list@fold (: (-> [Code Code] Code Code) (function (_ [s b] v) (` (..set@ (~ s) (~ v) (~ b))))) @@ -4719,7 +4719,7 @@ (do meta-monad [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) - (zip2 tags (enumerate members)))] + (zip/2 tags (enumeration members)))] (let [pattern (record$ (list@map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index 851a7c790..f8458caf3 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -379,7 +379,7 @@ (list) (|> actor-vars list.size list.indices (list@map (|>> code.nat (~) ($) (`))))) (: (List Code)) - (list.zip2 g!all-vars) + (list.zip/2 g!all-vars) (: (List [Code Code]))) g!outputT (list@fold (function (_ [g!var g!ref] outputT) (code.replace g!var g!ref outputT)) diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index 0b773a08e..0d21eb9fd 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -145,7 +145,7 @@ (All [a] (-> (-> a Text) (List a) Text)) (|> entries - list.enumerate + list.enumeration (list@map (function (_ [index entry]) [(n@encode index) (format entry)])) report')) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 8e1f83c1c..38a9bf63b 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -150,8 +150,8 @@ (let [[ys' xs'] (split-with' predicate #.Nil xs)] [(reverse ys') xs'])) -(def: #export (split-all n xs) - {#.doc "Segment the list in chunks of size n."} +(def: #export (chunk n xs) + {#.doc "Segment the list in chunks of size N."} (All [a] (-> Nat (List a) (List (List a)))) (case xs #.Nil @@ -159,7 +159,7 @@ _ (let [[pre post] (split n xs)] - (#.Cons pre (split-all n post))))) + (#.Cons pre (chunk n post))))) (def: #export (repeat n x) {#.doc "A list of the value x, repeated n times."} @@ -190,19 +190,6 @@ #.None (list x))) -(def: #export (find predicate xs) - {#.doc "Returns the first value in the list for which the predicate is #1."} - (All [a] - (-> (Predicate a) (List a) (Maybe a))) - (case xs - #.Nil - #.None - - (#.Cons x xs') - (if (predicate x) - (#.Some x) - (find predicate xs')))) - (def: #export (one check xs) (All [a b] (-> (-> a (Maybe b)) (List a) (Maybe b))) @@ -244,6 +231,16 @@ #.None (all check xs'))))) +(def: #export (find predicate xs) + {#.doc "Returns the first value in the list for which the predicate is #1."} + (All [a] + (-> (Predicate a) (List a) (Maybe a))) + (..one (function (_ value) + (if (predicate value) + (#.Some value) + #.None)) + xs)) + (def: #export (interpose sep xs) {#.doc "Puts a value between every two elements in the list."} (All [a] @@ -338,7 +335,7 @@ #.Nil ys (#.Cons x xs') (#.Cons x (compose xs' ys))))) -(open: "." monoid) +(open: "." ..monoid) (structure: #export functor (Functor List) @@ -451,8 +448,8 @@ (macro: #export (zip tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zip2 (zip 2)) - (def: #export zip3 (zip 3)) + (def: #export zip/2 (zip 2)) + (def: #export zip/3 (zip 3)) ((zip 3) xs ys zs))} (case tokens (^ (list [_ (#.Nat num-lists)])) @@ -490,13 +487,13 @@ _ (#.Left "Wrong syntax for zip"))) -(def: #export zip2 (zip 2)) -(def: #export zip3 (zip 3)) +(def: #export zip/2 (zip 2)) +(def: #export zip/3 (zip 3)) (macro: #export (zip-with tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zip2-with (zip-with 2)) - (def: #export zip3-with (zip-with 3)) + (def: #export zip-with/2 (zip-with 2)) + (def: #export zip-with/3 (zip-with 3)) ((zip-with 2) + xs ys))} (case tokens (^ (list [_ (#.Nat num-lists)])) @@ -537,8 +534,8 @@ _ (#.Left "Wrong syntax for zip-with"))) -(def: #export zip2-with (zip-with 2)) -(def: #export zip3-with (zip-with 3)) +(def: #export zip-with/2 (zip-with 2)) +(def: #export zip-with/3 (zip-with 3)) (def: #export (last xs) (All [a] (-> (List a) (Maybe a))) @@ -597,16 +594,14 @@ (All [M a] (-> (Monad M) (-> (M a) (M (List a))))) (:: monad map (:: ..monad wrap))) -(def: (enumerate' idx xs) - (All [a] (-> Nat (List a) (List [Nat a]))) - (case xs - #.Nil - #.Nil - - (#.Cons x xs') - (#.Cons [idx x] (enumerate' (inc idx) xs')))) - -(def: #export (enumerate xs) +(def: #export (enumeration xs) {#.doc "Pairs every element in the list with its index, starting at 0."} (All [a] (-> (List a) (List [Nat a]))) - (enumerate' 0 xs)) + (loop [idx 0 + xs xs] + (case xs + #.Nil + #.Nil + + (#.Cons x xs') + (#.Cons [idx x] (recur (inc idx) xs'))))) diff --git a/stdlib/source/lux/data/format/markdown.lux b/stdlib/source/lux/data/format/markdown.lux index bb9a86b46..a63cd7e72 100644 --- a/stdlib/source/lux/data/format/markdown.lux +++ b/stdlib/source/lux/data/format/markdown.lux @@ -104,7 +104,7 @@ (def: #export numbered-list (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) - (|>> list.enumerate + (|>> list.enumeration (list;map (function (_ [idx [summary detail]]) (format (%.nat (inc idx)) ". " (:representation summary) text.new-line (case detail diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index f59b0808a..b64e2eb62 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -259,7 +259,7 @@ (:: (dictionary.equivalence text.equivalence) = reference/attrs sample/attrs) (n.= (list.size reference/children) (list.size sample/children)) - (|> (list.zip2 reference/children sample/children) + (|> (list.zip/2 reference/children sample/children) (list.every? (product.uncurry =)))) _ diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index 08a1bf830..bb18e5596 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -119,7 +119,7 @@ (def: input-variables (-> (List Nullable) (List [Bit Code])) - (|>> list.enumerate + (|>> list.enumeration (list@map (function (_ [idx [nullable? type]]) [nullable? (|> idx %.nat code.local-identifier)])))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index efd6042f1..b4260c691 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -446,7 +446,7 @@ (<c>.tuple (<>.exactly (list.size arguments) <c>.any)))))] (wrap (` ("jvm member invoke constructor" (~ (code.text class-name)) (~+ (|> args - (list.zip2 (list@map product.right arguments)) + (list.zip/2 (list@map product.right arguments)) (list@map ..decorate-input)))))))) (def: (make-static-method-parser class-name method-name arguments) @@ -458,7 +458,7 @@ (<c>.tuple (<>.exactly (list.size arguments) <c>.any)))))] (wrap (` ("jvm member invoke static" (~ (code.text class-name)) (~ (code.text method-name)) (~+ (|> args - (list.zip2 (list@map product.right arguments)) + (list.zip/2 (list@map product.right arguments)) (list@map ..decorate-input)))))))) (template [<name> <jvm-op>] @@ -472,7 +472,7 @@ (wrap (` (<jvm-op> (~ (code.text class-name)) (~ (code.text method-name)) (~' _jvm_this) (~+ (|> args - (list.zip2 (list@map product.right arguments)) + (list.zip/2 (list@map product.right arguments)) (list@map ..decorate-input))))))))] [make-special-method-parser "jvm member invoke special"] @@ -1107,7 +1107,7 @@ (~ (code.text name)) (~' _jvm_this) (~+ (|> args - (list.zip2 (list@map product.right arguments)) + (list.zip/2 (list@map product.right arguments)) (list@map ..decorate-input)))))))))] (` ("override" (~ (declaration$ declaration)) @@ -1531,7 +1531,7 @@ (if maybe? (` ((~! !!!) (~ (un-quote input)))) (un-quote input)))) - (list.zip2 classes) + (list.zip/2 classes) (list@map (auto-convert-input mode)))) (def: (member-def-interop vars kind class [arg-function-inputs input-jvm-types arg-types] member method-prefix) @@ -1566,7 +1566,7 @@ (~ (code.text full-name)) [(~+ (list@map ..var$ (get@ #import-member-tvars commons)))] (~+ (|> (jvm-invoke-inputs (get@ #import-member-mode commons) input-jvm-types arg-function-inputs) - (list.zip2 input-jvm-types) + (list.zip/2 input-jvm-types) (list@map ..decorate-input)))))] (auto-convert-output (get@ #import-member-mode commons)) (decorate-return-maybe member true classT) @@ -1606,10 +1606,10 @@ [(~+ (list@map ..var$ (get@ #import-member-tvars commons)))] (~+ (|> object-ast (list@map ..un-quote) - (list.zip2 (list (type.class full-name (list)))) + (list.zip/2 (list (type.class full-name (list)))) (list@map (auto-convert-input (get@ #import-member-mode commons))))) (~+ (|> (jvm-invoke-inputs (get@ #import-member-mode commons) input-jvm-types arg-function-inputs) - (list.zip2 input-jvm-types) + (list.zip/2 input-jvm-types) (list@map ..decorate-input)))))) jvm-interop (: Code (case (type.void? method-return) diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux index 1e05c2fb7..fa726442b 100644 --- a/stdlib/source/lux/host.old.lux +++ b/stdlib/source/lux/host.old.lux @@ -1483,7 +1483,7 @@ (if maybe? (` ((~! !!!) (~ (un-quote input)))) (un-quote input)))) - (list.zip2 classes) + (list.zip/2 classes) (list@map (auto-convert-input mode)))) (def: (member-def-interop type-params kind class [arg-function-inputs arg-classes arg-types] member method-prefix) diff --git a/stdlib/source/lux/macro/template.lux b/stdlib/source/lux/macro/template.lux index 538aa8442..33dea631a 100644 --- a/stdlib/source/lux/macro/template.lux +++ b/stdlib/source/lux/macro/template.lux @@ -32,7 +32,7 @@ [g!locals (|> locals (list@map meta.gensym) (monad.seq @))] - (wrap (list (` (.with-expansions [(~+ (|> (list.zip2 locals g!locals) + (wrap (list (` (.with-expansions [(~+ (|> (list.zip/2 locals g!locals) (list@map (function (_ [name identifier]) (list (code.local-identifier name) (as-is identifier)))) list@join))] @@ -43,7 +43,9 @@ (do <>.monad [[module short] parser] (wrap (if module-side? - module + (case module + "" short + _ module) short)))) (def: (snippet module-side?) diff --git a/stdlib/source/lux/target/jvm/bytecode.lux b/stdlib/source/lux/target/jvm/bytecode.lux index a0856e34c..8b59f77ba 100644 --- a/stdlib/source/lux/target/jvm/bytecode.lux +++ b/stdlib/source/lux/target/jvm/bytecode.lux @@ -903,7 +903,7 @@ [>default (:: @ map ..big-jump (..jump @from @default)) >cases (|> @cases (monad.map @ (|>> (..jump @from) (:: @ map ..big-jump))) - (:: @ map (|>> (list.zip2 (list@map product.left cases)))))] + (:: @ map (|>> (list.zip/2 (list@map product.left cases)))))] (wrap [..no-exceptions (bytecode >default >cases)])) #.None diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux index 688bf3e02..7bc23199d 100644 --- a/stdlib/source/lux/target/jvm/reflection.lux +++ b/stdlib/source/lux/target/jvm/reflection.lux @@ -283,8 +283,8 @@ (if (text@= class-name name) (if (n.= num-class-params num-type-params) (|> params - (list.zip2 (list@map (|>> java/lang/reflect/TypeVariable::getName) - class-params)) + (list.zip/2 (list@map (|>> java/lang/reflect/TypeVariable::getName) + class-params)) (list@fold (function (_ [name paramT] mapping) (dictionary.put name paramT mapping)) /lux.fresh) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case.lux index f0b4faba6..c9443b43f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -194,14 +194,14 @@ num-sub-patterns (list.size sub-patterns) matches (cond (n.< num-subs num-sub-patterns) (let [[prefix suffix] (list.split (dec num-sub-patterns) subs)] - (list.zip2 (list@compose prefix (list (type.tuple suffix))) sub-patterns)) + (list.zip/2 (list@compose prefix (list (type.tuple suffix))) sub-patterns)) (n.> num-subs num-sub-patterns) (let [[prefix suffix] (list.split (dec num-subs) sub-patterns)] - (list.zip2 subs (list@compose prefix (list (code.tuple suffix))))) + (list.zip/2 subs (list@compose prefix (list (code.tuple suffix))))) ## (n.= num-subs num-sub-patterns) - (list.zip2 subs sub-patterns))] + (list.zip/2 subs sub-patterns))] (do @ [[memberP+ thenA] (list@fold (: (All [a] (-> [Type Code] (Operation [(List Pattern) a]) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index 896312463..bb9eef8cb 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -200,7 +200,7 @@ (and (n.= (list.size flatR) (list.size flatS)) (list.every? (function (_ [coverageR coverageS]) (= coverageR coverageS)) - (list.zip2 flatR flatS)))) + (list.zip/2 flatR flatS)))) _ #0))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux index 52b790d60..2430ce82f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -36,7 +36,7 @@ (ex.report ["Function type" (%.type functionT)] ["Function" (%.code functionC)] ["Arguments" (|> arguments - list.enumerate + list.enumeration (list@map (.function (_ [idx argC]) (format (%.nat idx) " " (%.code argC)))) (text.join-with text.new-line))])) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux index 3e06ed0e7..06b0c41c6 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -260,7 +260,7 @@ (list@fold (function (_ [idx tag] table) (plist.put tag [idx namespaced-tags exported? type] table)) tag-bindings - (list.enumerate tags)))) + (list.enumeration tags)))) (update@ #.types (plist.put type-name [namespaced-tags exported? type])))) state) []])) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 1355b25c6..fd0b58449 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -313,7 +313,7 @@ (wrap []) (/.throw ..record-size-mismatch [size-ts size-record recordT record])) #let [tuple-range (list.indices size-ts) - tag->idx (dictionary.from-list name.hash (list.zip2 tag-set tuple-range))] + tag->idx (dictionary.from-list name.hash (list.zip/2 tag-set tuple-range))] idx->val (monad.fold @ (function (_ [key val] idx->val) (do @ diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 46cfd01e6..9900c6764 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -1063,7 +1063,7 @@ #.None actualJC))))) true - (list.zip2 parameters inputsJT))]] + (list.zip/2 parameters inputsJT))]] (wrap (and correct-class? correct-method? static-matches? @@ -1093,7 +1093,7 @@ #.None actualJC))))) true - (list.zip2 parameters inputsJT)))))) + (list.zip/2 parameters inputsJT)))))) (def: idx-to-parameter (-> Nat .Type) @@ -1104,7 +1104,7 @@ (let [jvm-tvars (list@compose owner-tvars method-tvars) lux-tvars (|> jvm-tvars list.reverse - list.enumerate + list.enumeration (list@map (function (_ [idx name]) [name (idx-to-parameter idx)])) list.reverse) @@ -1214,8 +1214,8 @@ (def: (aliasing expected actual) (-> (List (Type Var)) (List (Type Var)) Aliasing) - (|> (list.zip2 (list@map jvm-parser.name actual) - (list@map jvm-parser.name expected)) + (|> (list.zip/2 (list@map jvm-parser.name actual) + (list@map jvm-parser.name expected)) (dictionary.from-list text.hash))) (def: (method-candidate actual-class-tvars class-name actual-method-tvars method-name method-style inputsJT) @@ -1295,7 +1295,7 @@ (def: (decorate-inputs typesT inputsA) (-> (List (Type Value)) (List Analysis) (List Analysis)) (|> inputsA - (list.zip2 (list@map (|>> ..signature /////analysis.text) typesT)) + (list.zip/2 (list@map (|>> ..signature /////analysis.text) typesT)) (list@map (function (_ [type value]) (/////analysis.tuple (list type value)))))) @@ -1890,7 +1890,7 @@ _ (phase.assert ..class-parameter-mismatch [expected-parameters actual-parameters] (n.= (list.size expected-parameters) (list.size actual-parameters)))] - (wrap (|> (list.zip2 expected-parameters actual-parameters) + (wrap (|> (list.zip/2 expected-parameters actual-parameters) (list@fold (function (_ [expected actual] mapping) (case (jvm-parser.var? actual) (#.Some actual) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 59241f43d..1e3a18cba 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -58,7 +58,7 @@ (function (_ [argT argC]) (typeA.with-type argT (analyse archive argC))) - (list.zip2 inputsT+ args))] + (list.zip/2 inputsT+ args))] (wrap (#////analysis.Extension extension-name argsA))) (////analysis.throw ///.incorrect-arity [extension-name num-expected num-actual])))))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index 935baa3db..7c4d09936 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -1023,7 +1023,7 @@ set.to-list) global-mapping (|> total-environment ## Give them names as "foreign" variables. - list.enumerate + list.enumeration (list@map (function (_ [id capture]) [capture (#//////variable.Foreign id)])) (dictionary.from-list //////variable.hash)) @@ -1033,7 +1033,7 @@ self-name arguments returnT exceptionsT body]]) (let [local-mapping (|> environment - list.enumerate + list.enumeration (list@map (function (_ [foreign-id capture]) [(#//////variable.Foreign foreign-id) (|> global-mapping diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/function.lux index 22c34fd21..36c082daf 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/function.lux @@ -42,7 +42,7 @@ _ (do {@ ////.monad} [@closure (:: @ map _.var (///.gensym "closure"))] - (wrap (_.labels (list [@closure [(|> (list.enumerate inits) + (wrap (_.labels (list [@closure [(|> (list.enumeration inits) (list@map (|>> product.left ..capture)) _.args) function-definition]]) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/loop.lux index 7abad4556..b5de4353e 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/common-lisp/loop.lux @@ -28,7 +28,7 @@ bodyG (///.with-anchor @scope (generate bodyS))] (wrap (_.labels (list [@scope {#_.input (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register)) _.args) #_.output bodyG}]) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux index 54595bb75..93b400c37 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -46,7 +46,7 @@ (let [capture (: (-> Register Var) (|>> (///reference.foreign //reference.system) :assume))] [(_.function! @self - (|> (list.enumerate inits) + (|> (list.enumeration inits) (list@map (|>> product.left capture))) (_.return (_.function @self (list) function-body))) (_.apply/* @self inits)]))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index 8863b30a3..07169e856 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -30,7 +30,7 @@ (def: (setup initial? offset bindings body) (-> Bit Register (List Expression) Statement Statement) (|> bindings - list.enumerate + list.enumeration (list@map (function (_ [register value]) (let [variable (//case.register (n.+ offset register))] (if initial? @@ -74,7 +74,7 @@ (statement expression archive bodyS)) #let [closure (_.closure (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register))) (_.with-label (_.label @scope) (_.do-while (_.boolean true) @@ -92,7 +92,7 @@ (_.define @temp (_.array argsO+)) (..setup false offset (|> argsO+ - list.enumerate + list.enumeration (list@map (function (_ [idx _]) (_.at (_.i32 (.int idx)) @temp)))) (_.continue-at (_.label @scope))))))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index ee594cde2..05ac70a6a 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -88,7 +88,7 @@ (do {@ macro.monad} [ids (monad.seq @ (list.repeat (list.size vars) macro.count))] (wrap (list (` (let [(~+ (|> vars - (list.zip2 ids) + (list.zip/2 ids) (list@map (function (_ [id var]) (list (code.local-identifier var) (` (_.var (~ (code.text (format "v" (%.nat id))))))))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index d52d8afbc..99a6c247e 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -123,7 +123,7 @@ (wrap ($_ _.compose abstractionG (|> inputsG - (list.split-all /arity.maximum) + (list.chunk /arity.maximum) (monad.map _.monad (function (_ batchG) ($_ _.compose diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index 095c07dc2..9e88895f5 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -98,7 +98,7 @@ (monad.seq _.monad)) #let [cases (|> (list@compose (#.Cons [@labelsH @labelsT]) (list @default)) - list.enumerate + list.enumeration (list@map (function (_ [stage @case]) (let [current-partials (|> (list.indices stage) (list@map (///partial.get class)) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux index 0f79b6e86..cea8fda10 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux @@ -41,7 +41,7 @@ (do {@ phase.monad} [[@begin offset] generation.anchor updatesG (|> updatesS - list.enumerate + list.enumeration (list@map (function (_ [index updateS]) [(n.+ offset index) updateS])) (monad.map @ (function (_ [register updateS]) @@ -77,7 +77,7 @@ initsI+ (monad.map @ (translate archive) initsS+) iterationG (generation.with-anchor [@begin offset] (translate archive iterationS)) - #let [initializationG (|> (list.enumerate initsI+) + #let [initializationG (|> (list.enumeration initsI+) (list@map (function (_ [index initG]) ($_ _.compose initG diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux index 79eafb572..eb786662c 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux @@ -37,7 +37,7 @@ _ (do {@ phase.monad} [membersI (|> membersS - list.enumerate + list.enumeration (monad.map @ (function (_ [idx member]) (do @ [memberI (generate archive member)] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index 755caf660..0f440080f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -48,7 +48,7 @@ (do {@ ///////phase.monad} [@closure (:: @ map _.var (/////generation.gensym "closure")) #let [directive (_.function @closure - (|> (list.enumerate inits) + (|> (list.enumeration inits) (list@map (|>> product.left ..capture))) ($_ _.then function-definition diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 06d187642..957924e8f 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -33,7 +33,7 @@ bodyO (/////generation.with-anchor @loop (generate archive bodyS)) #let [directive (_.function @loop (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register))) (_.return bodyO))] _ (/////generation.execute! directive) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 19b3fa46d..15734c737 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -34,7 +34,7 @@ (_.set @loopL) (_.closure (list (_.reference @loopL)) (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register [#0]))) (_.return bodyO))) (_.; (_.set @loopG @loopL)))] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux index cc3e27165..30f3f38fd 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -48,7 +48,7 @@ (do {@ ///////phase.monad} [@closure (:: @ map _.var (/////generation.gensym "closure")) #let [directive (_.def @closure - (|> (list.enumerate inits) + (|> (list.enumeration inits) (list@map (|>> product.left ..capture))) ($_ _.then function-definition diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 2edbab5ec..042cbba35 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -33,7 +33,7 @@ bodyO (/////generation.with-anchor @loop (generate archive bodyS)) #let [directive (_.def @loop (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register))) (_.return bodyO))] _ (/////generation.execute! directive) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index 08691f6f2..76a25d333 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -45,7 +45,7 @@ (|> function-definition _.return (_.lambda #.None - (|> (list.enumerate inits) + (|> (list.enumeration inits) (list@map (|>> product.left ..capture)))) (_.do "call" inits)))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index f5a2f1615..149e67c31 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -35,7 +35,7 @@ (wrap (|> (_.return bodyO) (_.lambda (#.Some @loop) (|> initsS+ - list.enumerate + list.enumeration (list@map (|>> product.left (n.+ start) //case.register)))) (_.apply/* initsO+))))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux index 59311ce15..ba48ab2ec 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux @@ -45,7 +45,7 @@ _ (let [@closure (_.var (format function-name "___CLOSURE"))] (_.letrec (list [@closure - (_.lambda [(|> (list.enumerate inits) + (_.lambda [(|> (list.enumeration inits) (list;map (|>> product.left ..capture))) #.None] function-definition)]) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux index a8a8447ef..aac83a7dc 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux @@ -28,7 +28,7 @@ bodyO (///.with-anchor @scope (generate bodyS))] (wrap (_.letrec (list [@scope (_.lambda [(|> initsS+ - list.enumerate + list.enumeration (list;map (|>> product.left (n.+ start) //case.register))) #.None] bodyO)]) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index 34c1edeaf..7c3c3975b 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -102,7 +102,7 @@ (` (_.define-constant (~ @runtime) [(list) #.None] (~ definition))) _ - (` (let [(~+ (|> (list.zip2 argsC+ argsLC+) + (` (let [(~+ (|> (list.zip/2 argsC+ argsLC+) (list;map (function (_ [left right]) (list left right))) list;join))] diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis/case.lux index d7225ca48..32db39342 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -85,7 +85,7 @@ (when> [(new> (not end?') [])] [(///@map ..clean-up)]) nextC)))) thenC - (list.reverse (list.enumerate tuple)))) + (list.reverse (list.enumeration tuple)))) )) (def: (path archive synthesize pattern bodyA) diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 81ce70e3d..ac92dbc80 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -158,7 +158,7 @@ "Unknown type parameter" text.new-line " Index: " (n@encode idx) text.new-line "Environment: " (|> env - list.enumerate + list.enumeration (list@map (.function (_ [index type]) ($_ text@compose (n@encode index) @@ -181,7 +181,7 @@ (n.= (list.size yparams) (list.size xparams)) (list@fold (.function (_ [x y] prev) (and prev (= x y))) #1 - (list.zip2 xparams yparams))) + (list.zip/2 xparams yparams))) (^template [<tag>] [(<tag> xid) (<tag> yid)] @@ -208,7 +208,7 @@ (= xbody ybody) (list@fold (.function (_ [x y] prev) (and prev (= x y))) #1 - (list.zip2 xenv yenv))) + (list.zip/2 xenv yenv))) _ #0 diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 4fb030df4..2295a3ed3 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -366,7 +366,7 @@ (#.Right [args _]) (do {@ meta.monad} [labels (|> (meta.gensym "") (list.repeat (list.size args)) (monad.seq @))] - (wrap (list (` (let [(~+ (|> (list.zip2 labels args) (list@map join-pair) list@join))] + (wrap (list (` (let [(~+ (|> (list.zip/2 labels args) (list@map join-pair) list@join))] (..::: (~ (code.identifier member)) (~+ labels))))))) )) @@ -383,7 +383,7 @@ (syntax: #export (implicit {structures ..implicits} body) (do meta.monad [g!implicit+ (implicit-bindings (list.size structures))] - (wrap (list (` (let [(~+ (|> (list.zip2 g!implicit+ structures) + (wrap (list (` (let [(~+ (|> (list.zip/2 g!implicit+ structures) (list@map (function (_ [g!implicit structure]) (list g!implicit structure))) list@join))] @@ -392,6 +392,6 @@ (syntax: #export (implicit: {structures ..implicits}) (do meta.monad [g!implicit+ (implicit-bindings (list.size structures))] - (wrap (|> (list.zip2 g!implicit+ structures) + (wrap (|> (list.zip/2 g!implicit+ structures) (list@map (function (_ [g!implicit structure]) (` (def: (~ g!implicit) (~ structure))))))))) diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index 0fec32a2d..69c2d24fb 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -123,7 +123,7 @@ (list (` [((~ (code.nat tag)) #0 (~ g!left)) ((~ (code.nat tag)) #0 (~ g!right))]) (` ((~ g!eq) (~ g!left) (~ g!right)))))) - (list.enumerate members)))) + (list.enumeration members)))) (~ g!_) #0)))))) ## Tuples @@ -135,7 +135,7 @@ g!rights (list@map (|>> nat@encode (text@compose "right") code.local-identifier) indices)]] (wrap (` (: (~ (@Equivalence inputT)) (function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)]) - (and (~+ (|> (list.zip3 g!eqs g!lefts g!rights) + (and (~+ (|> (list.zip/3 g!eqs g!lefts g!rights) (list@map (function (_ [g!eq g!left g!right]) (` ((~ g!eq) (~ g!left) (~ g!right))))))))))))) ## Type recursion diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index 93d94e06b..d1219bf87 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -60,7 +60,7 @@ (` ((~ (code.nat (dec tag))) #1 (~ memberC)))) (list (` ((~ (code.nat tag)) #0 (~ valueC))) (` ((~ (code.nat tag)) #0 (~ memberC)))))) - (list.enumerate membersC)))))))) + (list.enumeration membersC)))))))) ## Tuples (do p.monad [pairsCC (: (<type>.Parser (List [Code Code])) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 1f9234a4d..1921ecd3a 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -180,7 +180,7 @@ (` ((~! /.json) [(~ (code.frac (..tag tag))) #0 ((~ g!encode) (~ g!input))]))))) - (list.enumerate members)))))))))) + (list.enumeration members)))))))))) (do @ [g!encoders (<type>.tuple (p.many codec//encode)) #let [g!_ (code.local-identifier "_______") @@ -191,7 +191,7 @@ (function ((~ g!_) [(~+ g!members)]) ((~! /.json) [(~+ (list@map (function (_ [g!member g!encode]) (` ((~ g!encode) (~ g!member)))) - (list.zip2 g!members g!encoders)))])))))) + (list.zip/2 g!members g!encoders)))])))))) ## Type recursion (do @ [[selfC non-recC] (<type>.recursive codec//encode) @@ -291,7 +291,7 @@ ((~! p.after) ((~! </>.boolean!) (~ (code.bit #0)))) ((~! p.after) ((~! </>.number!) (~ (code.frac (..tag tag))))) ((~! </>.array)))))) - (list.enumerate members)))))))) + (list.enumeration members)))))))) (do @ [g!decoders (<type>.tuple (p.many codec//decode))] (wrap (` (: (~ (@JSON//decode inputT)) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index 86a45e606..bf12da1cd 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -124,7 +124,7 @@ _ (|> members - (list.zip2 tags) + (list.zip/2 tags) (list@map (function (_ [[_ t-name] type]) (case type (#.Product _) @@ -147,7 +147,7 @@ _ (let [member-docs (|> members - (list.zip2 tags) + (list.zip/2 tags) (list@map (function (_ [[_ t-name] type]) (if signature? (format "(: " (pprint-type-definition level type-func-info #.None module signature? recursive-type? type) text.new-line " " t-name ")") @@ -507,7 +507,7 @@ lux-exports (monad.map @ (function.compose macro.exports product.left) lux-modules) module-documentation (|> (list@map organize-definitions lux-exports) - (list.zip2 lux-modules) + (list.zip/2 lux-modules) (monad.map @ document-module)) #let [_ (io.run (monad.map io.monad save-documentation! module-documentation))]] (wrap (list)))) diff --git a/stdlib/source/spec/compositor/generation/structure.lux b/stdlib/source/spec/compositor/generation/structure.lux index fe5de3520..c0539a975 100644 --- a/stdlib/source/spec/compositor/generation/structure.lux +++ b/stdlib/source/spec/compositor/generation/structure.lux @@ -76,7 +76,7 @@ (and (n.= size (array.size tuple-out)) (list.every? (function (_ [left right]) (i.= left (:coerce Int right))) - (list.zip2 tuple-in (array.to-list tuple-out))))) + (list.zip/2 tuple-in (array.to-list tuple-out))))) (#try.Failure _) false))))) diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index b5aa7e34e..f4abc3887 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -12,7 +12,8 @@ ["#." project] ["#." cli] ["#." hash] - ["#." parser]]) + ["#." parser] + ["#." pom]]) (def: test Test @@ -24,6 +25,7 @@ /cli.test /hash.test /parser.test + /pom.test )) (program: args diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux new file mode 100644 index 000000000..d1f278da7 --- /dev/null +++ b/stdlib/source/test/aedifex/pom.lux @@ -0,0 +1,48 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + ["." try] + ["." exception] + ["<>" parser + ["<.>" xml]]] + [data + [format + ["." xml]]] + [math + ["." random]]] + [// + ["@." profile]] + {#program + ["." / + ["/#" // #_ + ["#" profile]]]}) + +(def: #export test + Test + (<| (_.covering /._) + (do random.monad + [expected @profile.random] + (_.cover [/.write /.parser] + (case [(/.write expected) + (get@ #//.identity expected)] + [(#try.Success pom) + (#.Some _)] + (case (<xml>.run /.parser pom) + (#try.Success actual) + (:: //.equivalence = + (|> (:: //.monoid identity) + (set@ #//.dependencies (get@ #//.dependencies expected))) + actual) + + (#try.Failure error) + false) + + [(#try.Failure error) + #.None] + (exception.match? //.no-identity error) + + _ + false))))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index e3311f505..8ed632ac5 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -149,13 +149,13 @@ [size (:: @ map (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) - #let [expected (dictionary.from-list text.hash (list.zip2 keys values))]] + #let [expected (dictionary.from-list text.hash (list.zip/2 keys values))]] (_.cover [/.dictionary] (|> (/.run (/.dictionary /.string) (#json.Object (|> values (list@map (|>> #json.String)) - (list.zip2 keys) + (list.zip/2 keys) (dictionary.from-list text.hash)))) (!expect (^multi (#try.Success actual) (:: (dictionary.equivalence text.equivalence) = expected actual)))))) diff --git a/stdlib/source/test/lux/data/collection/bits.lux b/stdlib/source/test/lux/data/collection/bits.lux index 166ced163..cadd2d26d 100644 --- a/stdlib/source/test/lux/data/collection/bits.lux +++ b/stdlib/source/test/lux/data/collection/bits.lux @@ -78,9 +78,10 @@ (/.set idx /.empty))) (not (/.intersects? sample (/.not sample))))) (_.cover [/.not] - (and (not (:: /.equivalence = sample (/.not sample))) - (:: /.equivalence = sample (/.not (/.not sample))) - (is? /.empty (/.not /.empty)))) + (and (is? /.empty (/.not /.empty)) + (or (is? /.empty sample) + (and (not (:: /.equivalence = sample (/.not sample))) + (:: /.equivalence = sample (/.not (/.not sample))))))) (_.cover [/.xor] (and (is? /.empty (/.xor sample sample)) (n.= (/.size (/.xor sample (/.not sample))) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index b2956fa85..181d6efa4 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -51,8 +51,8 @@ (_.cover [/.entries /.keys /.values] (:: (list.equivalence (equivalence.product n.equivalence n.equivalence)) = (/.entries dict) - (list.zip2 (/.keys dict) - (/.values dict)))) + (list.zip/2 (/.keys dict) + (/.values dict)))) (_.cover [/.merge] (let [merging-with-oneself (let [(^open ".") (/.equivalence n.equivalence)] @@ -67,8 +67,8 @@ (_.cover [/.merge-with] (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2)) - (list.zip2 (/.values dict) - (/.values (/.merge-with n.+ dict dict))))) + (list.zip/2 (/.values dict) + (/.values (/.merge-with n.+ dict dict))))) (_.cover [/.from-list] (let [(^open ".") (/.equivalence n.equivalence)] diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 32d73290f..f45f1d0d4 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -46,8 +46,8 @@ values (r.set n.hash size r.nat) extra-key (|> r.nat (r.filter (|>> (set.member? keys) not))) extra-value r.nat - #let [pairs (list.zip2 (set.to-list keys) - (set.to-list values)) + #let [pairs (list.zip/2 (set.to-list keys) + (set.to-list values)) sample (/.from-list n.order pairs) sorted-pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index e1f469fae..e6c971ae2 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -1,10 +1,10 @@ (.module: [lux #* - ["%" data/text/format (#+ format)] ["_" test (#+ Test)] [abstract [monad (#+ do)] ["." enum] + ["." equivalence] {[0 #spec] [/ ["$." equivalence] @@ -15,170 +15,400 @@ ["$." monad]]}] [control pipe - ["." io]] + ["." io] + ["." function]] [data ["." bit] ["." product] ["." maybe] + ["." text ("#@." equivalence)] [number ["n" nat] - ["." int]]] + ["." int]] + [collection + ["." set]]] [math - ["r" random]]] + ["." random (#+ Random)]]] {1 ["." / ("#@." monad)]}) (def: bounded-size - (r.Random Nat) - (|> r.nat - (:: r.monad map (|>> (n.% 100) (n.+ 10))))) + (Random Nat) + (:: random.monad map (n.% 100) + random.nat)) + +(def: random + (Random (List Nat)) + (do {@ random.monad} + [size ..bounded-size] + (|> random.nat + (random.set n.hash size) + (:: @ map set.to-list)))) (def: signatures Test - (do {@ r.monad} - [size bounded-size] + ($_ _.and + (_.with-cover [/.equivalence] + ($equivalence.spec (/.equivalence n.equivalence) ..random)) + (_.with-cover [/.monoid] + ($monoid.spec (/.equivalence n.equivalence) /.monoid ..random)) + (_.with-cover [/.fold] + ($fold.spec /@wrap /.equivalence /.fold)) + (_.with-cover [/.functor] + ($functor.spec /@wrap /.equivalence /.functor)) + (_.with-cover [/.apply] + ($apply.spec /@wrap /.equivalence /.apply)) + (_.with-cover [/.monad] + ($monad.spec /@wrap /.equivalence /.monad)) + + (do {@ random.monad} + [parameter random.nat + subject random.nat] + (let [lift (/.lift io.monad) + (^open "io@.") io.monad + expected (n.+ parameter subject)] + (_.cover [/.with /.lift] + (|> (io.run (do (/.with io.monad) + [a (lift (io@wrap parameter)) + b (wrap subject)] + (wrap (n.+ a b)))) + (case> (^ (list actual)) + (n.= expected actual) + + _ + false))))) + )) + +(def: whole + Test + (do {@ random.monad} + [size ..bounded-size + #let [(^open "/@.") (/.equivalence n.equivalence)] + sample (:: @ map set.to-list (random.set n.hash size random.nat))] ($_ _.and - ($equivalence.spec (/.equivalence n.equivalence) (r.list size r.nat)) - ($monoid.spec (/.equivalence n.equivalence) /.monoid (r.list size r.nat)) - ($fold.spec /@wrap /.equivalence /.fold) - ($functor.spec /@wrap /.equivalence /.functor) - ($apply.spec /@wrap /.equivalence /.apply) - ($monad.spec /@wrap /.equivalence /.monad) - - (do @ - [parameter r.nat - subject r.nat] - (let [lift (/.lift io.monad) - (^open "io@.") io.monad - expected (n.+ parameter subject)] - (_.test "Can add list functionality to any monad." - (|> (io.run (do (/.with io.monad) - [a (lift (io@wrap parameter)) - b (wrap subject)] - (wrap (n.+ a b)))) - (case> (^ (list actual)) - (n.= expected actual) - - _ - false))))) + (_.cover [/.size] + (n.= size (/.size sample))) + (_.cover [/.empty?] + (:: bit.equivalence = + (/.empty? sample) + (n.= 0 (/.size sample)))) + (_.cover [/.repeat] + (n.= size (/.size (/.repeat size [])))) + (_.cover [/.reverse] + (and (not (/@= sample + (/.reverse sample))) + (/@= sample + (/.reverse (/.reverse sample))))) + (_.cover [/.every? /.any?] + (if (/.every? n.even? sample) + (not (/.any? (bit.complement n.even?) sample)) + (/.any? (bit.complement n.even?) sample))) + (_.cover [/.sort] + (let [<<< n.< + + size-preservation! + (n.= (/.size sample) + (/.size (/.sort <<< sample))) + + symmetry! + (/@= (/.sort <<< sample) + (/.reverse (/.sort (function.flip <<<) sample)))] + (and size-preservation! + symmetry!))) ))) +(def: indices + Test + (let [(^open "/@.") (/.equivalence n.equivalence) + (^open "/@.") /.functor] + (do {@ random.monad} + [sample ..random + #let [size (/.size sample)]] + ($_ _.and + (_.cover [/.indices] + (let [indices (/.indices size) + + expected-amount! + (n.= size (/.size indices)) + + already-sorted! + (/@= indices + (/.sort n.< indices)) + + expected-numbers! + (/.every? (n.= (dec size)) + (/.zip-with/2 n.+ + indices + (/.sort n.> indices)))] + (and expected-amount! + already-sorted! + expected-numbers!))) + (_.cover [/.enumeration] + (let [enumeration (/.enumeration sample)] + (and (/@= (/.indices (/.size enumeration)) + (/@map product.left enumeration)) + (/@= sample + (/@map product.right enumeration))))) + (_.cover [/.nth] + (/.every? (function (_ [index expected]) + (case (/.nth index sample) + (#.Some actual) + (n.= expected actual) + + #.None + false)) + (/.enumeration sample))) + )))) + +(def: slice + Test + (let [(^open "/@.") (/.equivalence n.equivalence) + (^open "/@.") /.monoid] + (do {@ random.monad} + [sample ..random + #let [size (/.size sample)] + idx (:: @ map (n.% size) random.nat) + chunk-size (:: @ map (|>> (n.% size) inc) random.nat)] + ($_ _.and + (_.cover [/.filter] + (let [positives (/.filter n.even? sample) + negatives (/.filter (bit.complement n.even?) sample)] + (and (/.every? n.even? positives) + (not (/.any? n.even? negatives)) + + (n.= (/.size sample) + (n.+ (/.size positives) + (/.size negatives)))))) + (_.cover [/.partition] + (let [[positives negatives] (/.partition n.even? sample)] + (and (/@= (/.filter n.even? sample) + positives) + (/@= (/.filter (bit.complement n.even?) sample) + negatives)))) + (_.cover [/.split] + (let [[left right] (/.split idx sample)] + (/@= sample + (/@compose left right)))) + (_.cover [/.split-with] + (let [[left right] (/.split-with n.even? sample)] + (/@= sample + (/@compose left right)))) + (_.cover [/.take /.drop] + (/@= sample + (/@compose (/.take idx sample) + (/.drop idx sample)))) + (_.cover [/.take-while /.drop-while] + (/@= sample + (/@compose (/.take-while n.even? sample) + (/.drop-while n.even? sample)))) + (_.cover [/.chunk] + (let [chunks (/.chunk chunk-size sample)] + (and (/.every? (|>> /.size (n.<= chunk-size)) chunks) + (/@= sample + (/.concat chunks))))) + )))) + +(def: member + Test + (let [(^open "/@.") (/.equivalence n.equivalence)] + (do {@ random.monad} + [sample ..random] + (`` ($_ _.and + (_.cover [/.member?] + (/.every? (/.member? n.equivalence sample) + sample)) + (~~ (template [<head> <tail> <pre>] + [($_ _.and + (_.cover [<head>] + (case [(<pre> sample) (<head> sample)] + [(#.Cons expected _) (#.Some actual)] + (n.= expected actual) + + [#.Nil #.None] + true + + _ + false)) + (_.cover [<tail>] + (case [(<pre> sample) (<tail> sample)] + [(#.Cons _ expected) (#.Some actual)] + (/@= (<pre> expected) actual) + + [#.Nil #.None] + true + + _ + false)) + )] + + [/.head /.tail |>] + [/.last /.inits /.reverse] + )) + ))))) + +(def: grouping + Test + (let [(^open "/@.") (/.equivalence n.equivalence) + (^open "/@.") /.functor + (^open "/@.") /.monoid + + +/2 (: (-> Nat Nat Nat) + (function (_ left right) + ($_ n.+ left right))) + +/3 (: (-> Nat Nat Nat Nat) + (function (_ left mid right) + ($_ n.+ left mid right)))] + (do {@ random.monad} + [sample/0 ..random + sample/1 ..random + sample/2 ..random] + ($_ _.and + (_.cover [/.as-pairs] + (n.= (n./ 2 (/.size sample/0)) + (/.size (/.as-pairs sample/0)))) + (_.cover [/.zip/2] + (let [zipped (/.zip/2 sample/0 sample/1) + zipped::size (/.size zipped) + + size-of-smaller-list! + (n.= zipped::size + (n.min (/.size sample/0) (/.size sample/1))) + + can-extract-values! + (and (/@= (/.take zipped::size sample/0) + (/@map product.left zipped)) + (/@= (/.take zipped::size sample/1) + (/@map product.right zipped)))] + (and size-of-smaller-list! + can-extract-values!))) + (_.cover [/.zip/3] + (let [zipped (/.zip/3 sample/0 sample/1 sample/2) + zipped::size (/.size zipped) + + size-of-smaller-list! + (n.= zipped::size + ($_ n.min + (/.size sample/0) + (/.size sample/1) + (/.size sample/2))) + + can-extract-values! + (and (/@= (/.take zipped::size sample/0) + (/@map product.left zipped)) + (/@= (/.take zipped::size sample/1) + (/@map (|>> product.right product.left) zipped)) + (/@= (/.take zipped::size sample/2) + (/@map (|>> product.right product.right) zipped)))] + (and size-of-smaller-list! + can-extract-values!))) + (_.cover [/.zip] + (and (:: (/.equivalence (equivalence.product n.equivalence n.equivalence)) = + (/.zip/2 sample/0 sample/1) + ((/.zip 2) sample/0 sample/1)) + (:: (/.equivalence ($_ equivalence.product n.equivalence n.equivalence n.equivalence)) = + (/.zip/3 sample/0 sample/1 sample/2) + ((/.zip 3) sample/0 sample/1 sample/2)))) + + (_.cover [/.zip-with/2] + (/@= (/@map (function (_ [left right]) + (+/2 left right)) + (/.zip/2 sample/0 sample/1)) + (/.zip-with/2 +/2 sample/0 sample/1))) + (_.cover [/.zip-with/3] + (/@= (/@map (function (_ [left mid right]) + (+/3 left mid right)) + (/.zip/3 sample/0 sample/1 sample/2)) + (/.zip-with/3 +/3 sample/0 sample/1 sample/2))) + (_.cover [/.zip-with] + (and (/@= (/.zip-with/2 +/2 sample/0 sample/1) + ((/.zip-with 2) +/2 sample/0 sample/1)) + (/@= (/.zip-with/3 +/3 sample/0 sample/1 sample/2) + ((/.zip-with 3) +/3 sample/0 sample/1 sample/2)))) + (_.cover [/.concat] + (and (/@= (/@compose sample/0 sample/1) + (/.concat (list sample/0 sample/1))) + (/@= ($_ /@compose sample/0 sample/1 sample/2) + (/.concat (list sample/0 sample/1 sample/2))))) + )))) + +(def: search + Test + (let [(^open "/@.") /.functor + + choose (: (-> Nat (Maybe Text)) + (function (_ value) + (if (n.even? value) + (#.Some (:: n.decimal encode value)) + #.None)))] + (do {@ random.monad} + [sample ..random] + ($_ _.and + (_.cover [/.one] + (case [(|> sample + (/.filter n.even?) + (/@map (:: n.decimal encode)) + /.head) + (/.one choose sample)] + [(#.Some expected) (#.Some actual)] + (text@= expected actual) + + [#.None #.None] + true + + _ + false)) + (_.cover [/.all] + (:: (/.equivalence text.equivalence) = + (|> sample + (/.filter n.even?) + (/@map (:: n.decimal encode))) + (/.all choose sample))) + (_.cover [/.find] + (case (/.find n.even? sample) + (#.Some found) + (and (n.even? found) + (/.any? n.even? sample) + (not (/.every? (bit.complement n.even?) sample))) + + #.None + (and (not (/.any? n.even? sample)) + (/.every? (bit.complement n.even?) sample)))) + )))) + (def: #export test Test - (<| (_.context (%.name (name-of .List))) - (do {@ r.monad} - [size bounded-size - #let [(^open "/@.") (/.equivalence n.equivalence) - (^open "/@.") /.functor - (^open "/@.") /.monoid] - idx (:: @ map (n.% size) r.nat) - sample (r.list size r.nat) - other-size bounded-size - other-sample (r.list other-size r.nat) - separator r.nat] - ($_ _.and - ..signatures - - (_.test "The size function should correctly portray the size of the list." - (n.= size (/.size sample))) - (_.test "The repeat function should produce as many elements as asked of it." - (n.= size (/.size (/.repeat size [])))) - (_.test "Reversing a list does not change it's size." - (n.= (/.size sample) - (/.size (/.reverse sample)))) - (_.test "Reversing a list twice results in the original list." - (/@= sample - (/.reverse (/.reverse sample)))) - (_.test "Filtering by a predicate and its complement should result in a number of elements equal to the original list." - (and (n.= (/.size sample) - (n.+ (/.size (/.filter n.even? sample)) - (/.size (/.filter (bit.complement n.even?) sample)))) - (let [[plus minus] (/.partition n.even? sample)] - (n.= (/.size sample) - (n.+ (/.size plus) - (/.size minus)))))) - (_.test "If every element in a list satisfies a predicate, there can't be any that satisfy its complement." - (if (/.every? n.even? sample) - (and (not (/.any? (bit.complement n.even?) sample)) - (/.empty? (/.filter (bit.complement n.even?) sample))) - (/.any? (bit.complement n.even?) sample))) - (_.test "Any element of the list can be considered its member." - (let [elem (maybe.assume (/.nth idx sample))] - (/.member? n.equivalence sample elem))) - (_.test "Appending the head and the tail should yield the original list." - (let [head (maybe.assume (/.head sample)) - tail (maybe.assume (/.tail sample))] - (/@= sample - (#.Cons head tail)))) - (_.test "Appending the inits and the last should yield the original list." - (let [inits (maybe.assume (/.inits sample)) - last (maybe.assume (/.last sample))] - (/@= sample - (/@compose inits (list last))))) - (_.test "Splitting a list into chunks and re-appending them should yield the original list." - (let [[left right] (/.split idx sample) - [left' right'] (/.split-with n.even? sample)] - (and (/@= sample - (/@compose left right)) - (/@= sample - (/@compose left' right')) - (/@= sample - (/@compose (/.take idx sample) - (/.drop idx sample))) - (/@= sample - (/@compose (/.take-while n.even? sample) - (/.drop-while n.even? sample))) - ))) - (_.test "Segmenting the list in pairs should yield as many elements as N/2." - (n.= (n./ 2 size) - (/.size (/.as-pairs sample)))) - (_.test "Sorting a list shouldn't change it's size." - (n.= (/.size sample) - (/.size (/.sort n.< sample)))) - (_.test "Sorting a list with one order should yield the reverse of sorting it with the opposite order." - (/@= (/.sort n.< sample) - (/.reverse (/.sort n.> sample)))) - (_.test "If you zip 2 lists, the result's size will be that of the smaller list." - (n.= (/.size (/.zip2 sample other-sample)) - (n.min (/.size sample) (/.size other-sample)))) - (_.test "I can pair-up elements of a list in order." - (let [zipped (/.zip2 sample other-sample) - num-zipper (/.size zipped)] - (and (|> zipped (/@map product.left) (/@= (/.take num-zipper sample))) - (|> zipped (/@map product.right) (/@= (/.take num-zipper other-sample)))))) - (_.test "You can generate indices for any size, and they will be in ascending order." - (let [indices (/.indices size)] - (and (n.= size (/.size indices)) - (/@= indices - (/.sort n.< indices)) - (/.every? (n.= (dec size)) - (/.zip2-with n.+ - indices - (/.sort n.> indices))) - ))) - (_.test "The 'interpose' function places a value between every member of a list." - (let [sample+ (/.interpose separator sample)] - (and (n.= (|> size (n.* 2) dec) - (/.size sample+)) - (|> sample+ /.as-pairs (/@map product.right) (/.every? (n.= separator)))))) - (_.test "You can find any value that satisfies some criterium, if such values exist in the list." - (case (/.find n.even? sample) - (#.Some found) - (and (n.even? found) - (/.any? n.even? sample) - (not (/.every? (bit.complement n.even?) sample))) - - #.None - (and (not (/.any? n.even? sample)) - (/.every? (bit.complement n.even?) sample)))) - (_.test "You can iteratively construct a list, generating values until you're done." - (/@= (enum.range n.enum 0 (dec size)) - (/.iterate (function (_ n) (if (n.< size n) (#.Some (inc n)) #.None)) - 0))) - (_.test "Can enumerate all elements in a list." - (let [enum-sample (/.enumerate sample)] - (and (/@= (/.indices (/.size enum-sample)) - (/@map product.left enum-sample)) - (/@= sample - (/@map product.right enum-sample))))) - )))) + (<| (_.covering /._) + (_.with-cover [.List]) + (let [(^open "/@.") (/.equivalence n.equivalence) + (^open "/@.") /.functor] + (do {@ random.monad} + [sample ..random + separator random.nat] + ($_ _.and + ..signatures + ..whole + ..indices + ..slice + ..member + ..grouping + ..search + + (_.cover [/.interpose] + (let [sample+ (/.interpose separator sample)] + (and (n.= (|> (/.size sample) (n.* 2) dec) + (/.size sample+)) + (|> sample+ /.as-pairs (/.every? (|>> product.right (n.= separator))))))) + (_.cover [/.iterate] + (let [size (/.size sample)] + (/@= (/.indices size) + (/.iterate (function (_ index) + (if (n.< size index) + (#.Some (inc index)) + #.None)) + 0)))) + (_.cover [/.folds] + (/@= (/@map (function (_ index) + (:: /.fold fold n.+ 0 (/.take index sample))) + (/.indices (inc (/.size sample)))) + (/.folds n.+ 0 sample))) + ))))) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 9b85a557c..f6a1ca855 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -108,9 +108,9 @@ (do {@ random.monad} [parts (..random-sequence replace-simulation)] (wrap [(/.record (let [parts' (list@map product.left parts)] - (list.zip2 parts' parts'))) + (list.zip/2 parts' parts'))) (/.record (let [parts' (list@map product.right parts)] - (list.zip2 parts' parts')))])) + (list.zip/2 parts' parts')))])) ))))) (def: #export test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 71c523649..b59ae9ca2 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -98,7 +98,7 @@ member-wise-patterns (monad.map @ (exhaustive-branches allow-literals? variantTC) vs)] (wrap (|> member-wise-patterns exhaustive-weaving - (list@map (|>> (list.zip2 ks) code.record))))) + (list@map (|>> (list.zip/2 ks) code.record))))) (^ [_ (#.Form (list [_ (#.Tag _)] _))]) (do {@ r.monad} @@ -130,7 +130,7 @@ [size (|> r.nat (:: @ map (n.% 3))) elems (r.list size input)] (wrap (code.tuple elems))) - (r@wrap (code.record (list.zip2 record-tags primitivesC))) + (r@wrap (code.record (list.zip/2 record-tags primitivesC))) )))) (def: (branch body pattern) @@ -152,7 +152,7 @@ code-tag (|>> [module-name] code.tag) variant-tags+ (list@map code-tag variant-tags) record-tags+ (list@map code-tag record-tags) - variantTC (list.zip2 variant-tags+ primitivesC)] + variantTC (list.zip/2 variant-tags+ primitivesC)] inputC (input variant-tags+ record-tags+ primitivesC) [outputT outputC] (r.filter (|>> product.left (is? Any) not) _primitive.primitive) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index fb3c1fe60..6da982c17 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -287,7 +287,7 @@ primitivesT (list@map product.left primitives) primitivesC (list@map product.right primitives) monoT (#.Named [module-name type-name] (type.tuple primitivesT)) - recordC (list.zip2 tagsC primitivesC) + recordC (list.zip/2 tagsC primitivesC) polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 2209bf366..5f8e46d3c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -300,15 +300,15 @@ (wrap [(list@fold (function (_ left right) (#synthesis.Alt left right)) (path (inc mid-size) true value/last body/last) - (|> (list.zip2 value/mid body/mid) + (|> (list.zip/2 value/mid body/mid) (#.Cons [value/first body/first]) - list.enumerate + list.enumeration (list@map (function (_ [lefts' [value body]]) (path lefts' false value body))) list.reverse)) [(branch 0 false value/first body/first) - (list@compose (|> (list.zip2 value/mid body/mid) - list.enumerate + (list@compose (|> (list.zip/2 value/mid body/mid) + list.enumeration (list@map (function (_ [lefts' [value body]]) (branch (inc lefts') false value body)))) (list (branch (inc mid-size) true value/last body/last)))]]))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 5b092ce51..eaca9c528 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -448,7 +448,7 @@ (!expect (^multi (^ (#try.Success (synthesis.function/apply [funcS argsS]))) (and (//primitive.corresponds? funcA funcS) (list.every? (product.uncurry //primitive.corresponds?) - (list.zip2 argsA argsS)))))) + (list.zip/2 argsA argsS)))))) (|> (analysis.apply [funcA (list)]) (//.phase archive.empty) (phase.run [///bundle.empty synthesis.init]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux index 40f9efad4..1a215fb3b 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux @@ -65,7 +65,7 @@ (list.size actual)) (list.every? (function (_ [expected actual]) (corresponds? expected actual)) - (list.zip2 expected actual))) + (list.zip/2 expected actual))) _ false))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index 7dea796fc..24adb599c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -67,7 +67,7 @@ (case> (^ (#try.Success (////synthesis.tuple membersS))) (and (n.= size (list.size membersS)) (list.every? (product.uncurry //primitive.corresponds?) - (list.zip2 membersA membersS))) + (list.zip/2 membersA membersS))) _ false))))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index b90829862..0789d5ddd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -249,7 +249,7 @@ (n.+ fake-start idx) context)) necessary - (list.enumerate inits))) + (list.enumeration inits))) context))] (wrap [(synthesis.loop/scope [real-start (list@map product.left inits) expected-iteration]) (synthesis.loop/scope [fake-start (list@map product.right inits) actual-iteration])]))) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 96fd5fcbb..5a0942252 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -222,7 +222,7 @@ same-types? (list.every? (type@= boundT) (list& (maybe.default headT head-bound) (list@map (function (_ [tail-id ?tailT]) (maybe.default (#.Var tail-id) ?tailT)) - (list.zip2 ids tail-bound))))] + (list.zip/2 ids tail-bound))))] (/.assert "" (and rings-were-erased? same-types?)))))) |