From ec1f31b5a1492d5e0ab260397291d4449483bbd9 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 23 Aug 2021 02:30:53 -0400 Subject: The Python compiler can now be compiled by the new JVM compiler. --- .../specification/compositor/generation/case.lux | 10 ++++----- stdlib/source/specification/lux/abstract/apply.lux | 25 +++++++++++----------- stdlib/source/specification/lux/abstract/codec.lux | 2 +- stdlib/source/specification/lux/abstract/fold.lux | 23 -------------------- stdlib/source/specification/lux/abstract/mix.lux | 23 ++++++++++++++++++++ stdlib/source/specification/lux/world/file.lux | 6 +++--- 6 files changed, 44 insertions(+), 45 deletions(-) delete mode 100644 stdlib/source/specification/lux/abstract/fold.lux create mode 100644 stdlib/source/specification/lux/abstract/mix.lux (limited to 'stdlib/source/specification') diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 8508220ed..87fc1a5fc 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -13,7 +13,7 @@ ["n" nat] ["f" frac]] [collection - ["." list ("#\." fold)]]] + ["." list ("#\." mix)]]] [math ["r" random (#+ Random)]] [tool @@ -152,7 +152,7 @@ (function (_ head tail) (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) _list_ (: (-> (List Synthesis) Synthesis) - (list\fold _item_ _end_))] + (list\mix _item_ _end_))] (let [__tuple__ (: (-> (List Synthesis) Synthesis) (|>> list.reversed _list_ [9 #0] synthesis.variant _code_)) __form__ (: (-> (List Synthesis) Synthesis) @@ -169,9 +169,9 @@ (_code_ (synthesis.variant [7 #0 (synthesis.tuple (list (synthesis.text module) (synthesis.text short)))])))) __list__ (: (-> (List Synthesis) Synthesis) - (list\fold (function (_ head tail) - (__form__ (list (__tag__ ["" "Item"]) head tail))) - (__tag__ ["" "End"]))) + (list\mix (function (_ head tail) + (__form__ (list (__tag__ ["" "Item"]) head tail))) + (__tag__ ["" "End"]))) __apply__ (: (-> Synthesis Synthesis Synthesis) (function (_ func arg) (__form__ (list func arg))))] diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 71df69a83..e857c81e5 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -21,7 +21,7 @@ [sample (\ ! map injection random.nat)] (_.test "Identity." ((comparison n.=) - (\apply (injection function.identity) sample) + (\on sample (injection function.identity)) sample)))) (def: (homomorphism injection comparison (^open "\.")) @@ -31,7 +31,7 @@ increase (\ ! map n.+ random.nat)] (_.test "Homomorphism." ((comparison n.=) - (\apply (injection increase) (injection sample)) + (\on (injection sample) (injection increase)) (injection (increase sample)))))) (def: (interchange injection comparison (^open "\.")) @@ -41,8 +41,9 @@ increase (\ ! map n.+ random.nat)] (_.test "Interchange." ((comparison n.=) - (\apply (injection increase) (injection sample)) - (\apply (injection (function (_ f) (f sample))) (injection increase)))))) + (\on (injection sample) (injection increase)) + (\on (injection increase) (injection (: (-> (-> Nat Nat) Nat) + (function (_ f) (f sample))))))))) (def: (composition injection comparison (^open "\.")) (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) @@ -52,15 +53,13 @@ decrease (\ ! map n.- random.nat)] (_.test "Composition." ((comparison n.=) - (_$ \apply - (injection function.composite) - (injection increase) - (injection decrease) - (injection sample)) - ($_ \apply - (injection increase) - (injection decrease) - (injection sample)))))) + (|> (injection function.composite) + (\on (injection increase)) + (\on (injection decrease)) + (\on (injection sample))) + (\on (\on (injection sample) + (injection increase)) + (injection decrease)))))) (def: .public (spec injection comparison apply) (All [f] (-> (Injection f) (Comparison f) (Apply f) Test)) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index 3cbb712d2..1725bbc92 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -19,7 +19,7 @@ [expected generator] (_.for [/.Codec] (_.test "Isomorphism." - (case (|> expected @//encode @//decode) + (case (|> expected @//encoded @//decoded) (#try.Success actual) (@//= expected actual) diff --git a/stdlib/source/specification/lux/abstract/fold.lux b/stdlib/source/specification/lux/abstract/fold.lux deleted file mode 100644 index 6d3ad1f7e..000000000 --- a/stdlib/source/specification/lux/abstract/fold.lux +++ /dev/null @@ -1,23 +0,0 @@ -(.module: - [library - [lux #* - ["_" test (#+ Test)] - [abstract - [monad (#+ do)]] - [math - ["." random] - [number - ["n" nat]]]]] - [// - [functor (#+ Injection Comparison)]] - [\\library - ["." /]]) - -(def: .public (spec injection comparison (^open "@//.")) - (All [f] (-> (Injection f) (Comparison f) (/.Fold f) Test)) - (do random.monad - [subject random.nat - parameter random.nat] - (_.cover [/.Fold] - (n.= (@//fold n.+ parameter (injection subject)) - (n.+ parameter subject))))) diff --git a/stdlib/source/specification/lux/abstract/mix.lux b/stdlib/source/specification/lux/abstract/mix.lux new file mode 100644 index 000000000..1097ac37f --- /dev/null +++ b/stdlib/source/specification/lux/abstract/mix.lux @@ -0,0 +1,23 @@ +(.module: + [library + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [math + ["." random] + [number + ["n" nat]]]]] + [// + [functor (#+ Injection Comparison)]] + [\\library + ["." /]]) + +(def: .public (spec injection comparison (^open "@//.")) + (All [f] (-> (Injection f) (Comparison f) (/.Mix f) Test)) + (do random.monad + [subject random.nat + parameter random.nat] + (_.cover [/.Mix] + (n.= (@//mix n.+ parameter (injection subject)) + (n.+ parameter subject))))) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 0b5414dea..504990ea4 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -260,8 +260,8 @@ in (do {! async.monad} [fs (async.future fs) - make_file!/0 (/.make_file ! fs (utf8\encode file/0) file/0) - make_file!/1 (/.make_file ! fs (utf8\encode file/0) file/0)]) + make_file!/0 (/.make_file ! fs (utf8\encoded file/0) file/0) + make_file!/1 (/.make_file ! fs (utf8\encoded file/0) file/0)]) ($_ _.and' (_.cover' [/.make_file] (case make_file!/0 @@ -298,7 +298,7 @@ pre_dir/0 (\ fs directory? dir) pre_dir/1 (/.exists? ! fs dir) - made_file? (/.make_file ! fs (utf8\encode file) file) + made_file? (/.make_file ! fs (utf8\encoded file) file) made_dir? (\ fs make_directory dir) post_file/0 (\ fs file? file) -- cgit v1.2.3