From 7c144b96453c9aa28436dcffd90af7cbe6c323f6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 20 Aug 2023 19:49:31 -0400 Subject: [PATCH] Re-named `Ratio` to `Frac`. --- stdlib/source/documentation/lux/abstract.lux | 2 - .../source/documentation/lux/math/number.lux | 4 +- .../lux/math/number/{ratio.lux => frac.lux} | 12 +- .../documentation/lux/meta/type/unit.lux | 6 +- stdlib/source/format/lux/data/text.lux | 4 +- .../lux/{abstract => algorithm}/mix.lux | 6 +- .../library/lux/control/concurrency/actor.lux | 94 +++-- .../library/lux/data/collection/array.lux | 3 +- .../library/lux/data/collection/list.lux | 184 +++++----- .../library/lux/data/collection/sequence.lux | 3 +- .../library/lux/data/collection/tree.lux | 3 +- stdlib/source/library/lux/debug.lux | 4 +- stdlib/source/library/lux/ffi/export.lua.lux | 4 +- stdlib/source/library/lux/math.lux | 26 +- .../lux/math/number/{ratio.lux => frac.lux} | 75 ++-- stdlib/source/library/lux/math/random.lux | 4 +- .../library/lux/meta/type/unit/scale.lux | 28 +- .../source/library/lux/world/time/series.lux | 3 +- stdlib/source/program/aedifex/input.lux | 3 +- stdlib/source/test/lux/abstract.lux | 2 - stdlib/source/test/lux/algorithm.lux | 2 + .../test/lux/{abstract => algorithm}/mix.lux | 0 .../source/test/lux/data/collection/array.lux | 5 +- .../source/test/lux/data/collection/list.lux | 5 +- .../test/lux/data/collection/sequence.lux | 5 +- .../source/test/lux/data/collection/tree.lux | 5 +- stdlib/source/test/lux/data/text.lux | 4 +- stdlib/source/test/lux/debug.lux | 8 +- stdlib/source/test/lux/math.lux | 32 +- stdlib/source/test/lux/math/number.lux | 4 +- .../lux/math/number/{ratio.lux => frac.lux} | 34 +- stdlib/source/test/lux/math/random.lux | 4 +- .../source/test/lux/meta/type/unit/scale.lux | 14 +- stdlib/source/test/lux/music/instrument.lux | 345 ++++++++++-------- stdlib/source/test/lux/music/percussion.lux | 178 +++++---- stdlib/source/test/lux/music/pitch.lux | 336 +++++++++-------- stdlib/source/test/lux/music/scale.lux | 124 ++++--- stdlib/source/test/lux/web/dom/event.lux | 301 ++++++++------- stdlib/source/test/lux/world/time/series.lux | 5 +- to_do.md | 12 +- 40 files changed, 1020 insertions(+), 873 deletions(-) rename stdlib/source/documentation/lux/math/number/{ratio.lux => frac.lux} (82%) rename stdlib/source/library/lux/{abstract => algorithm}/mix.lux (96%) rename stdlib/source/library/lux/math/number/{ratio.lux => frac.lux} (86%) rename stdlib/source/test/lux/{abstract => algorithm}/mix.lux (100%) rename stdlib/source/test/lux/math/number/{ratio.lux => frac.lux} (86%) diff --git a/stdlib/source/documentation/lux/abstract.lux b/stdlib/source/documentation/lux/abstract.lux index f2c92c41fd..f0a0c40d8e 100644 --- a/stdlib/source/documentation/lux/abstract.lux +++ b/stdlib/source/documentation/lux/abstract.lux @@ -14,7 +14,6 @@ ["[1][0]" comonad] ["[1][0]" enum] ["[1][0]" equivalence] - ["[1][0]" mix] ["[1][0]" functor] ["[1][0]" hash] ["[1][0]" interval] @@ -30,7 +29,6 @@ /comonad.documentation /enum.documentation /equivalence.documentation - /mix.documentation /functor.documentation /hash.documentation /interval.documentation diff --git a/stdlib/source/documentation/lux/math/number.lux b/stdlib/source/documentation/lux/math/number.lux index 2ee0bb1600..afb8b40fcb 100644 --- a/stdlib/source/documentation/lux/math/number.lux +++ b/stdlib/source/documentation/lux/math/number.lux @@ -21,7 +21,7 @@ ["[1][0]" int] ["[1][0]" rev] ["[1][0]" dec] - ["[1][0]" ratio] + ["[1][0]" frac] ["[1][0]" complex]]) (`` (the .public documentation @@ -51,7 +51,7 @@ /int.documentation /rev.documentation /dec.documentation - /ratio.documentation + /frac.documentation /complex.documentation ) ))) diff --git a/stdlib/source/documentation/lux/math/number/ratio.lux b/stdlib/source/documentation/lux/math/number/frac.lux similarity index 82% rename from stdlib/source/documentation/lux/math/number/ratio.lux rename to stdlib/source/documentation/lux/math/number/frac.lux index 2c98f5b5a2..4408ecd15a 100644 --- a/stdlib/source/documentation/lux/math/number/ratio.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -14,7 +14,7 @@ (the .public documentation (List $.Documentation) (list ($.module /._ - "Rational numbers.") + "Fractions.") ($.definition /.nat) ($.definition /.=) @@ -34,13 +34,13 @@ ($.definition /.addition) ($.definition /.multiplication) - ($.definition /.Ratio + ($.definition /.Frac "An unsigned ratio of numbers.") - ($.definition /.ratio - "Rational literals." - ($.example (' (ratio numerator denominator))) + ($.definition /.frac + "Fraction literals." + ($.example (' (frac numerator denominator))) ($.comment "The denominator can be omitted if it is 1.") - ($.example (' (ratio numerator)))) + ($.example (' (frac numerator)))) )) diff --git a/stdlib/source/documentation/lux/meta/type/unit.lux b/stdlib/source/documentation/lux/meta/type/unit.lux index 36ccdaf88d..0fa9ca85a9 100644 --- a/stdlib/source/documentation/lux/meta/type/unit.lux +++ b/stdlib/source/documentation/lux/meta/type/unit.lux @@ -10,7 +10,7 @@ ["%" \\format (.only format)]]] [math [number - ["[0]" ratio]]] + ["[0]" frac]]] [meta [macro ["[0]" template]]]]] @@ -69,8 +69,8 @@ ... (,, (with_template [ ] ... [(`` ($.definition - ... (let [numerator (its [/.ratio ratio.#numerator] ) - ... denominator (its [/.ratio ratio.#denominator] )] + ... (let [numerator (its [/.frac frac.#numerator] ) + ... denominator (its [/.frac frac.#denominator] )] ... (format "The '" (,, (template.text [])) "' scale, from " (%.nat numerator) " to " (%.nat denominator) "."))))] ... [/.Kilo /.kilo] diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux index e9075a3132..dca7bbc3cc 100644 --- a/stdlib/source/format/lux/data/text.lux +++ b/stdlib/source/format/lux/data/text.lux @@ -25,7 +25,7 @@ ["[0]" int] ["[0]" rev] ["[0]" dec] - ["[0]" ratio] + ["[0]" frac] ["[0]" complex]] [arithmetic ["[0]" modular]]] @@ -72,7 +72,7 @@ [dec Dec (of dec.decimal encoded)] [text Text text.format] - [ratio ratio.Ratio (of ratio.codec encoded)] + [frac frac.Frac (of frac.codec encoded)] [complex complex.Complex complex.format] [symbol Symbol (of symbol.absolute encoded)] diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/algorithm/mix.lux similarity index 96% rename from stdlib/source/library/lux/abstract/mix.lux rename to stdlib/source/library/lux/algorithm/mix.lux index 063a16fa9b..59004e5407 100644 --- a/stdlib/source/library/lux/abstract/mix.lux +++ b/stdlib/source/library/lux/algorithm/mix.lux @@ -4,9 +4,9 @@ (.require [library [lux (.except) - ["//" algorithm]]] - [// - [monoid (.only Monoid)]]) + [abstract + [monoid (.only Monoid)]]]] + ["[0]" //]) (every .public (Mix !) (Interface diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index ecdc47980f..9e91d03706 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -29,20 +29,21 @@ (exception.the .public poisoned) (exception.the .public dead) -(local.let [ (template (_ Actor s) - [(-> s (Actor s) (Async (Try s)))]) - (template (_ Actor s) - [[Text s (List ( Actor s))]]) - (template (_ Actor s) +(local.let [ (template (_ Actor state) + [(-> state (Actor state) + (Async (Try state)))]) + (template (_ Actor state) + [[Text state (List ( Actor state))]]) + (template (_ Actor state) [(Rec Mailbox - [(Async [( Actor s) Mailbox]) - (Resolver [( Actor s) Mailbox])])])] + [(Async [( Actor state) Mailbox]) + (Resolver [( Actor state) Mailbox])])])] (these (the (pending [read write]) - (All (_ a) + (All (_ of) (-> (Rec Mailbox - [(Async [a Mailbox]) - (Resolver [a Mailbox])]) - (IO (List a)))) + [(Async [of Mailbox]) + (Resolver [of Mailbox])]) + (IO (List of)))) (do [! io.monad] [current (async.value read)] (when current @@ -53,23 +54,26 @@ {.#None} (in {.#End})))) - (nominal.every .public (Actor s) + (nominal.every .public (Actor state) (Record - [#obituary [(Async ( Actor s)) - (Resolver ( Actor s))] - #mailbox (Atom ( Actor s))]) + [#obituary [(Async ( Actor state)) + (Resolver ( Actor state))] + #mailbox (Atom ( Actor state))]) - (every .public (Mail s) - ( Actor s)) + (every .public (Mail state) + ( Actor state)) - (every .public (Obituary s) - ( Actor s)) + (every .public (Obituary state) + ( Actor state)) - (every .public (Behavior s) - (-> (Mail s) s (Actor s) (Async (Try s)))) + (every .public (Behavior state) + (-> (Mail state) state (Actor state) + (Async (Try state)))) (the .public (spawn! behavior init) - (All (_ s) (-> (Behavior s) s (IO (Actor s)))) + (All (_ state) + (-> (Behavior state) state + (IO (Actor state)))) (io (let [self (`` (is (Actor (,, (type_of init))) (nominal.abstraction [#obituary (async.async []) @@ -94,7 +98,9 @@ self))) (the .public (alive? actor) - (All (_ s) (-> (Actor s) (IO Bit))) + (All (_ state) + (-> (Actor state) + (IO Bit))) (let [[obituary _] (its #obituary (nominal.representation actor))] (|> obituary async.value @@ -107,18 +113,24 @@ bit.no)))))) (the .public (obituary' actor) - (All (_ s) (-> (Actor s) (IO (Maybe (Obituary s))))) + (All (_ state) + (-> (Actor state) + (IO (Maybe (Obituary state))))) (let [[obituary _] (its #obituary (nominal.representation actor))] (async.value obituary))) (the .public obituary - (All (_ s) (-> (Actor s) (Async (Obituary s)))) + (All (_ state) + (-> (Actor state) + (Async (Obituary state)))) (|>> nominal.representation (its #obituary) product.left)) (the .public (mail! mail actor) - (All (_ s) (-> (Mail s) (Actor s) (IO (Try Any)))) + (All (_ state) + (-> (Mail state) (Actor state) + (IO (Try Any)))) (do [! io.monad] [alive? (..alive? actor)] (if alive? @@ -142,16 +154,20 @@ (again |mailbox|')))))) (in (exception.except ..dead []))))) - (every .public (Message s o) - (-> s (Actor s) (Async (Try [s o])))) + (every .public (Message state of) + (-> state (Actor state) + (Async (Try [state of])))) (the (mail message) - (All (_ s o) (-> (Message s o) [(Async (Try o)) (Mail s)])) - (let [[async resolve] (sharing [s o] - (is (Message s o) + (All (_ state of) + (-> (Message state of) + [(Async (Try of)) + (Mail state)])) + (let [[async resolve] (sharing [state of] + (is (Message state of) message) - (is [(Async (Try o)) - (Resolver (Try o))] + (is [(Async (Try of)) + (Resolver (Try of))] (async.async [])))] [async (function (_ state self) @@ -169,7 +185,9 @@ (async.resolved {try.#Failure error})))))])) (the .public (request! message actor) - (All (_ s o) (-> (Message s o) (Actor s) (Async (Try o)))) + (All (_ state of) + (-> (Message state of) (Actor state) + (Async (Try of)))) (let [[async mail] (..mail message)] (do async.monad [outcome (async.future (..mail! mail actor))] @@ -187,7 +205,9 @@ (mail state self))) (the .public (poison! actor) - (All (_ s) (-> (Actor s) (IO (Try Any)))) + (All (_ state) + (-> (Actor state) + (IO (Try Any)))) (..mail! (function (_ state self) (async.resolved (exception.except ..poisoned []))) actor)) @@ -199,7 +219,9 @@ (the stop! false) (the .public (observe! action channel actor) - (All (_ r w s) (-> (-> r Stop (Mail s)) (Channel' r w) (Actor s) (IO Any))) + (All (_ read write state) + (-> (-> read Stop (Mail state)) (Channel' read write) (Actor state) + (IO Any))) (let [signal (is (Atom Bit) (atom.atom ..continue!)) stop (is Stop diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 535a680d89..afe5677c75 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -7,7 +7,8 @@ [abstract [monoid (.only Monoid)] [functor (.only Functor)] - [equivalence (.only Equivalence)] + [equivalence (.only Equivalence)]] + [algorithm [mix (.only Mix)]] [control ["[0]" try (.only Try)] diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 118414d3b4..2296f7868d 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -9,10 +9,11 @@ [apply (.only Apply)] [equivalence (.only Equivalence)] [hash (.only Hash)] - [mix (.only Mix)] ["[0]" functor (.only Functor)] ["[0]" monad (.only Monad do)] ["[0]" enum]] + [algorithm + [mix (.only Mix)]] [control ["[0]" try (.only Try)] [function @@ -28,7 +29,7 @@ ... (every (List of) ... (Variant -... #End +... {#End} ... {#Item of (List of)})) (the .public mix @@ -36,22 +37,22 @@ (implementation (the (mix f init xs) (.when xs - {.#End} - init - {.#Item x xs'} - (mix f (f x init) xs'))))) + (mix f (f x init) xs') + + end + init)))) (the .public (mixes f init inputs) (All (_ of mix) (-> (-> of mix mix) mix (List of) (List mix))) (.when inputs - {.#End} - (list init) - {.#Item [head tail]} - {.#Item [init (mixes f (f head init) tail)]})) + {.#Item [init (mixes f (f head init) tail)]} + + end + (list init))) (the .public (reversed it) (All (_ of) @@ -67,27 +68,27 @@ (-> (Predicate of) (List of) (List of))) (.when xs - {.#End} - {.#End} - {.#Item x xs'} (if (keep? x) {.#Item x (only keep? xs')} - (only keep? xs')))) + (only keep? xs')) + + end + end)) (the .public (partition satisfies? list) (All (_ of) (-> (Predicate of) (List of) [(List of) (List of)])) (.when list - {.#End} - [{.#End} {.#End}] - {.#Item head tail} (let [[in out] (partition satisfies? tail)] (if (satisfies? head) [{.#Item head in} out] - [in {.#Item head out}])))) + [in {.#Item head out}])) + + end + [end end])) (the .public partial (macro (_ tokens state) @@ -132,11 +133,11 @@ (List of))) (if (n.> 0 n) (.when xs - {.#End} - {.#End} - {.#Item x xs'} - ) + + + end + end) ))] [first {.#Item x (first (-- n) xs')} {.#End}] @@ -149,13 +150,13 @@ (-> (Predicate of) (List of) (List of))) (.when xs - {.#End} - {.#End} - {.#Item x xs'} (if (predicate x) - )))] + ) + + end + end))] [while {.#Item x (while predicate xs')} {.#End}] [until xs (until predicate xs')] @@ -168,25 +169,25 @@ (.when n 0 [{.#End} xs] _ (.when xs - {.#End} - [{.#End} {.#End}] - {.#Item x xs'} (let [[tail rest] (split_at (-- n) xs')] - [{.#Item x tail} rest])))) + [{.#Item x tail} rest]) + + end + [end end]))) (the (split_when' predicate ys xs) (All (_ of) (-> (Predicate of) (List of) (List of) [(List of) (List of)])) (.when xs - {.#End} - [ys xs] - {.#Item x xs'} (if (predicate x) [ys xs] - (split_when' predicate {.#Item x ys} xs')))) + (split_when' predicate {.#Item x ys} xs')) + + end + [ys xs])) (the .public (split_when predicate xs) (All (_ of) @@ -247,16 +248,16 @@ (-> (-> input (Maybe output)) (List input) (Try output))) (.when xs - {.#End} - {try.#Failure ..no_one} - {.#Item x xs'} (.when (check x) {.#None} (one check xs') {.#Some it} - {try.#Success it}))) + {try.#Success it}) + + end + {try.#Failure ..no_one})) (the .public (all check xs) (All (_ a b) @@ -273,16 +274,16 @@ {.#End} (reversed xs)) (.when xs - {.#End} - {.#End} - {.#Item x xs'} (.when (check x) {.#Some output} {.#Item output (all check xs')} {.#None} - (all check xs'))))) + (all check xs')) + + {.#End} + {.#End}))) (the .public (example predicate xs) (All (_ of) @@ -299,20 +300,23 @@ (-> of (List of) (List of))) (.when xs - {.#End} + (list x) xs - {.#Item x {.#End}} - xs + (..partial x xs') + (..partial x sep (interposed sep xs')) - {.#Item x xs'} - (partial x sep (interposed sep xs')))) + end + end)) (the .public (size list) (All (_ of) (-> (List of) Nat)) - (mix (function (_ _ acc) (n.+ 1 acc)) 0 list)) + (mix (function (_ _ acc) + (++ acc)) + 0 + list)) (with_template [ ] [(the .public ( predicate items) @@ -320,12 +324,12 @@ (-> (Predicate of) (List of) Bit)) (.when items - {.#End} - - {.#Item head tail} ( (predicate head) - ( predicate tail))))] + ( predicate tail)) + + end + ))] [every? #1 and] [any? #0 or] @@ -341,13 +345,13 @@ (-> Nat (List of) (Try of))) (.when xs - {.#End} - {try.#Failure ..no_item} - {.#Item x xs'} (.when i 0 {try.#Success x} - _ (item (-- i) xs')))) + _ (item (-- i) xs')) + + end + {try.#Failure ..no_item})) (the .public (equivalence Equivalence) (All (_ of) @@ -438,9 +442,6 @@ (-> (-> of of Bit) (List of) (List of))) (.when xs - {.#End} - (list) - {.#Item x xs'} (let [[pre post] (mix (function (_ x' [pre post]) (if (< x x') @@ -454,7 +455,10 @@ (.all composite (sorted < pre) (list x) - (sorted < post))))) + (sorted < post))) + + end + end)) (the .public (empty? xs) (All (_ of) @@ -471,12 +475,12 @@ (-> (Equivalence of) (List of) of Bit)) (.when xs - {.#End} - false - {.#Item x' xs'} (or (of eq = x x') - (member? eq xs' x)))) + (member? eq xs' x)) + + end + false)) (the .public empty Error @@ -489,11 +493,11 @@ (-> (List of) (Try ))) (.when it - {.#End} - {try.#Failure ..empty} - {.#Item head tail} - {try.#Success }))] + {try.#Success } + + end + {try.#Failure ..empty}))] [head of] [tail (List of)] @@ -534,7 +538,7 @@ 0 output' _ (again input' output'))))) -(the .public cannot_zip_no_lists +(the .public cannot_zip_0_lists Error (location.with (location.here) "Cannot zip 0 lists.")) @@ -572,7 +576,7 @@ (, g!blank) {.#End}))))] {.#Right [state (list code)]}) - {.#Left ..cannot_zip_no_lists}) + {.#Left ..cannot_zip_0_lists}) _ {.#Left .wrong_syntax}))) @@ -616,7 +620,7 @@ (, g!blank) {.#End}))))] {.#Right [state (list code)]}) - {.#Left ..cannot_zip_no_lists}) + {.#Left ..cannot_zip_0_lists}) _ {.#Left .wrong_syntax}))) @@ -629,33 +633,33 @@ (-> (List of) (Try of))) (.when xs - {.#End} - {try.#Failure ..empty} - - {.#Item x {.#End}} + (list x) {try.#Success x} - {.#Item x xs'} - (last xs'))) + (..partial x xs') + (last xs') + + end + {try.#Failure ..empty})) (the .public (inits xs) (All (_ of) (-> (List of) (Try (List of)))) (.when xs - {.#End} - {try.#Failure ..empty} - - {.#Item x {.#End}} + (list x) {try.#Success {.#End}} - {.#Item x xs'} + (..partial x xs') (.when (inits xs') {try.#Success tail} {try.#Success {.#Item x tail}} {try.#Failure _} (undefined)) + + end + {try.#Failure ..empty} )) (the .public together @@ -701,11 +705,11 @@ (loop (again [idx 0 xs xs]) (.when xs - {.#End} - {.#End} - {.#Item x xs'} - {.#Item [idx x] (again (++ idx) xs')}))) + {.#Item [idx x] (again (++ idx) xs')} + + end + (list)))) (the .public when (template (_ ) @@ -718,10 +722,10 @@ (-> Nat (-> of of) (List of) (List of))) (.when it - {.#End} - {.#End} - {.#Item head tail} (.when item 0 {.#Item (revision head) tail} - _ (revised (-- item) revision it)))) + _ (revised (-- item) revision it)) + + end + end)) diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 243ec9a031..d08a0a240b 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -12,7 +12,8 @@ [apply (.only Apply)] [monad (.only Monad do)] [equivalence (.only Equivalence)] - [monoid (.only Monoid)] + [monoid (.only Monoid)]] + [algorithm [mix (.only Mix)]] [control ["<>" parser] diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index bf8811d886..6b2f2e64d9 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -7,8 +7,9 @@ [abstract [functor (.only Functor)] [equivalence (.only Equivalence)] - [mix (.only Mix)] [monad (.only do)]] + [algorithm + [mix (.only Mix)]] [control ["<>" parser]] [data diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index aa9b0cbee9..717544c303 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -27,7 +27,7 @@ ["[0]" dictionary]]] [math [number - [ratio (.only Ratio)] + [frac (.only Frac)] ["n" nat] ["i" int]]] ["[0]" meta (.only) @@ -415,7 +415,7 @@ [_ (.sub )] (in (|>> (as ) )))] - [Ratio %.ratio] + [Frac %.frac] [Symbol %.symbol] [Location %.location] [Type %.type] diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index f8666664e3..f0330f0f8d 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -21,9 +21,9 @@ [macro [syntax (.only syntax)] ["[0]" expansion]] - [target - ["/" lua]] [compiler + [target + ["/" lua]] [meta [cache ["[0]" dependency diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 49a3dc3e38..ed350936b8 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -38,7 +38,7 @@ ["[0]" int] ["[0]" rev] ["[0]" dec] - ["[0]" ratio (.only Ratio)] + ["[0]" frac (.only Frac)] ["[0]" complex (.only Complex)]]]) (exception.the (no_arithmetic_for type) @@ -66,8 +66,8 @@ prevs))))) (for .old (these) - (with_expansions [ [ratio.#numerator 0 ratio.#denominator 1] - [ratio.#numerator 1 ratio.#denominator 1] + (with_expansions [ [frac.#numerator 0 frac.#denominator 1] + [frac.#numerator 1 frac.#denominator 1] [complex.#real +0.0 complex.#imaginary +0.0] [complex.#real +1.0 complex.#imaginary +0.0]] (these (with_template [ '] @@ -116,25 +116,25 @@ [.Int (in (analysis.int location.dummy +0)) .i64_+#|translation] [.Rev (in (analysis.rev location.dummy .0)) .i64_+#|translation] [.Dec (in (analysis.dec location.dummy +0.0)) .f64_+#|translation] - [Ratio (type.expecting Ratio (phase archive (` ))) ratio.+] + [Frac (type.expecting Frac (phase archive (` ))) frac.+] [Complex (type.expecting Complex (phase archive (` ))) complex.+]]] [- [[.Nat (in (analysis.nat location.dummy 0)) .i64_-#|translation] [.Int (in (analysis.int location.dummy -0)) .i64_-#|translation] [.Rev (in (analysis.rev location.dummy .0)) .i64_-#|translation] [.Dec (in (analysis.dec location.dummy -0.0)) .f64_-#|translation] - [Ratio (type.expecting Ratio (phase archive (` ))) ratio.-] + [Frac (type.expecting Frac (phase archive (` ))) frac.-] [Complex (type.expecting Complex (phase archive (` ))) complex.-]]] [* [[.Nat (in (analysis.nat location.dummy 1)) nat.*] [.Int (in (analysis.int location.dummy +1)) .int_*#|translation] [.Rev (in (analysis.rev location.dummy rev./1)) rev.*] [.Dec (in (analysis.dec location.dummy +1.0)) .f64_*#|translation] - [Ratio (type.expecting Ratio (phase archive (` ))) ratio.*] + [Frac (type.expecting Frac (phase archive (` ))) frac.*] [Complex (type.expecting Complex (phase archive (` ))) complex.*]]] [/ [[.Nat (in (analysis.nat location.dummy 1)) nat./] [.Int (in (analysis.int location.dummy +1)) .int_/#|translation] [.Rev (in (analysis.rev location.dummy rev./1)) rev./] [.Dec (in (analysis.dec location.dummy +1.0)) .f64_/#|translation] - [Ratio (type.expecting Ratio (phase archive (` ))) ratio./] + [Frac (type.expecting Frac (phase archive (` ))) frac./] [Complex (type.expecting Complex (phase archive (` ))) complex./]]] ) (with_template [ '] @@ -166,28 +166,28 @@ [.Int .i64_=#|translation] [.Rev .i64_=#|translation] [.Dec .f64_=#|translation] - [Ratio ratio.=] + [Frac frac.=] [Complex complex.=]]] [< [[.Nat nat.<] [.Int .int_<#|translation] [.Rev rev.<] [.Dec .f64_<#|translation] - [Ratio ratio.<]]] + [Frac frac.<]]] [> [[.Nat nat.>] [.Int int.>] [.Rev rev.>] [.Dec dec.>] - [Ratio ratio.>]]] + [Frac frac.>]]] [<= [[.Nat nat.<=] [.Int int.<=] [.Rev rev.<=] [.Dec dec.<=] - [Ratio ratio.<=]]] + [Frac frac.<=]]] [>= [[.Nat nat.>=] [.Int int.>=] [.Rev rev.>=] [.Dec dec.>=] - [Ratio ratio.>=]]] + [Frac frac.>=]]] ) (with_template [ '] [(with_expansions [ (template.spliced ')] @@ -218,7 +218,7 @@ [.Int .int_%#|translation] [.Rev rev.%] [.Dec .f64_%#|translation] - [Ratio ratio.%] + [Frac frac.%] [Complex complex.%]]] ) ))) diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/frac.lux similarity index 86% rename from stdlib/source/library/lux/math/number/ratio.lux rename to stdlib/source/library/lux/math/number/frac.lux index 814e5656ea..719b0dd70e 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -1,6 +1,7 @@ ... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. +... [Fraction](https://en.wikipedia.org/wiki/Fraction) (.require [library [lux (.except nat) @@ -31,7 +32,7 @@ [// [arithmetic (.only Arithmetic)]]]) -(every .public Ratio +(every .public Frac (Record [#numerator Nat #denominator Nat])) @@ -42,27 +43,27 @@ "Not a natural number.")) (the .public (nat value) - (-> Ratio + (-> Frac (Try Nat)) (when (its #denominator value) 1 {try.#Success (its #numerator value)} _ {try.#Failure ..not_a_nat})) (the .public (normal (open "/[0]")) - (-> Ratio - Ratio) + (-> Frac + Frac) (let [common (n.gcd /#numerator /#denominator)] [..#numerator (n./ common /#numerator) ..#denominator (n./ common /#denominator)])) -(the .public ratio +(the .public frac (syntax (_ [numerator .any ?denominator (<>.maybe .any)]) (in (list (` (normal [..#numerator (, numerator) ..#denominator (, (maybe.else (' 1) ?denominator))])))))) (the .public (= parameter subject) - (-> Ratio Ratio + (-> Frac Frac Bit) (n.= (n.* (its #numerator parameter) (its #denominator subject)) @@ -70,12 +71,12 @@ (its #numerator subject)))) (the .public equivalence - (Equivalence Ratio) + (Equivalence Frac) (implementation (the = ..=))) (the (equalized parameter subject) - (-> Ratio Ratio + (-> Frac Frac [Nat Nat]) [(n.* (its #denominator subject) (its #numerator parameter)) @@ -83,74 +84,74 @@ (its #numerator subject))]) (the .public (< parameter subject) - (-> Ratio Ratio + (-> Frac Frac Bit) (let [[parameter' subject'] (..equalized parameter subject)] (n.< parameter' subject'))) (the .public (<= parameter subject) - (-> Ratio Ratio + (-> Frac Frac Bit) (or (< parameter subject) (= parameter subject))) (the .public (> parameter subject) - (-> Ratio Ratio + (-> Frac Frac Bit) (..< subject parameter)) (the .public (>= parameter subject) - (-> Ratio Ratio + (-> Frac Frac Bit) (or (> parameter subject) (= parameter subject))) (the .public order - (Order Ratio) + (Order Frac) (implementation (the equivalence ..equivalence) (the < ..<))) (the .public (+ parameter subject) - (-> Ratio Ratio - Ratio) + (-> Frac Frac + Frac) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.+ parameter' subject') (n.* (its #denominator parameter) (its #denominator subject))]))) (the .public (- parameter subject) - (-> Ratio Ratio - Ratio) + (-> Frac Frac + Frac) (let [[parameter' subject'] (..equalized parameter subject)] (normal [(n.- parameter' subject') (n.* (its #denominator parameter) (its #denominator subject))]))) (the .public (* parameter subject) - (-> Ratio Ratio - Ratio) + (-> Frac Frac + Frac) (normal [(n.* (its #numerator parameter) (its #numerator subject)) (n.* (its #denominator parameter) (its #denominator subject))])) (the .public (/ parameter subject) - (-> Ratio Ratio - Ratio) + (-> Frac Frac + Frac) (let [[parameter' subject'] (..equalized parameter subject)] (normal [subject' parameter']))) (the .public (% parameter subject) - (-> Ratio Ratio - Ratio) + (-> Frac Frac + Frac) (let [[parameter' subject'] (..equalized parameter subject) quot (n./ parameter' subject')] (..- (revised #numerator (n.* quot) parameter) subject))) (the .public arithmetic - (Arithmetic Ratio) + (Arithmetic Frac) (implementation (the + ..+) (the - ..-) @@ -158,15 +159,15 @@ (the / ../))) (the .public (reciprocal (open "/[0]")) - (-> Ratio - Ratio) + (-> Frac + Frac) [..#numerator /#denominator ..#denominator /#numerator]) (the separator ":") (the .public codec - (Codec Text Ratio) + (Codec Text Frac) (implementation (the (encoded (open "/[0]")) (all text#composite @@ -183,13 +184,13 @@ #denominator denominator]))) {.#None} - {.#Left (text#composite "Invalid syntax for ratio: " input)})))) + {.#Left (text#composite "Invalid syntax for fraction: " input)})))) (with_template [ ] [(the .public - (Monoid Ratio) + (Monoid Frac) (implementation - (the identity (..ratio )) + (the identity (..frac )) (the composite )))] [0 ..+ addition] @@ -197,24 +198,24 @@ ) (the .public zero - Ratio + Frac [#numerator 0 #denominator 1]) (the .public one - Ratio + Frac [#numerator 1 #denominator 1]) -(with_template [ ] - [(the .public - Ratio +(with_template [ ] + [(the .public + Frac [#numerator #denominator 0]) (the .public - (Predicate Ratio) - (|>> (= ) + (Predicate Frac) + (|>> (= ) not))] [1 finite? infinity] diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index fee1ea0f40..c0828aa509 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -32,7 +32,7 @@ ["n" nat] ["i" int] ["d" dec] - ["r" ratio] + ["f" frac] ["c" complex] ["[0]" i64]]] [meta @@ -208,7 +208,7 @@ right ] (in ( left right))))] - [ratio r.Ratio r.ratio ..nat] + [frac f.Frac f.frac ..nat] [complex c.Complex c.complex ..safe_dec] ) diff --git a/stdlib/source/library/lux/meta/type/unit/scale.lux b/stdlib/source/library/lux/meta/type/unit/scale.lux index 4729358240..e1c816cc33 100644 --- a/stdlib/source/library/lux/meta/type/unit/scale.lux +++ b/stdlib/source/library/lux/meta/type/unit/scale.lux @@ -7,7 +7,7 @@ [math [number ["i" int] - ["[0]" ratio (.only Ratio)]]] + ["[0]" frac (.only Frac)]]] [meta ["[0]" code ["<[1]>" \\parser]] @@ -22,12 +22,12 @@ up) (is (All (_ u) (-> (//.Measure s u) (//.Measure Any u))) down) - (is Ratio - ratio))) + (is Frac + frac))) -(the .public (scale ratio) - (Ex (_ s) (-> Ratio (Scale s))) - (let [(open "/[0]") ratio] +(the .public (scale frac) + (Ex (_ s) (-> Frac (Scale s))) + (let [(open "/[0]") frac] (implementation (the up (|>> //.number @@ -39,13 +39,13 @@ (i.* (.int /#denominator)) (i./ (.int /#numerator)) //.measure)) - (the ratio - ratio)))) + (the frac + frac)))) (the .public (re_scaled from to measure) (All (_ si so u) (-> (Scale si) (Scale so) (//.Measure si u) (//.Measure so u))) - (let [(open "/[0]") (ratio./ (of from ratio) - (of to ratio))] + (let [(open "/[0]") (frac./ (of from frac) + (of to frac))] (|> measure //.number (i.* (.int /#numerator)) @@ -62,8 +62,8 @@ (with_template [ ] [(the .public - (scale [ratio.#numerator - ratio.#denominator 1])) + (scale [frac.#numerator + frac.#denominator 1])) (the .public (let [[module _] (symbol .._) @@ -72,8 +72,8 @@ (..type )})) (the .public - (scale [ratio.#numerator 1 - ratio.#denominator ])) + (scale [frac.#numerator 1 + frac.#denominator ])) (the .public (let [[module _] (symbol .._) diff --git a/stdlib/source/library/lux/world/time/series.lux b/stdlib/source/library/lux/world/time/series.lux index 6233568d6a..dfc04c8486 100644 --- a/stdlib/source/library/lux/world/time/series.lux +++ b/stdlib/source/library/lux/world/time/series.lux @@ -7,8 +7,9 @@ [abstract [equivalence (.only Equivalence)] [functor (.only Functor)] - [mix (.only Mix)] [monad (.only do)]] + [algorithm + [mix (.only Mix)]] [control ["[0]" try (.only Try)] ["[0]" exception (.only Exception)]] diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index e136904a99..b6eea6df2e 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -5,7 +5,8 @@ [library [lux (.except) [abstract - ["[0]" monad (.only Monad do)] + ["[0]" monad (.only Monad do)]] + [algorithm ["[0]" mix]] [control ["[0]" pipe] diff --git a/stdlib/source/test/lux/abstract.lux b/stdlib/source/test/lux/abstract.lux index bbce0d1b24..60ebda4f2c 100644 --- a/stdlib/source/test/lux/abstract.lux +++ b/stdlib/source/test/lux/abstract.lux @@ -14,7 +14,6 @@ ["[1][0]" enum] ["[1][0]" equivalence] ["[1][0]" hash] - ["[1][0]" mix] ["[1][0]" functor (.only) ["[1]/[0]" contravariant]] ["[1][0]" interval] @@ -44,7 +43,6 @@ /enum.test /equivalence.test /hash.test - /mix.test /interval.test /monoid.test /order.test diff --git a/stdlib/source/test/lux/algorithm.lux b/stdlib/source/test/lux/algorithm.lux index ed8b5cb3ee..9cc02a3a22 100644 --- a/stdlib/source/test/lux/algorithm.lux +++ b/stdlib/source/test/lux/algorithm.lux @@ -9,6 +9,7 @@ [\\library ["[0]" /]] ["[0]" / + ["[1][0]" mix] ["[1][0]" size]]) (the .public test @@ -18,5 +19,6 @@ /.Sum /.Product /.Recursive]) (all _.and + /mix.test /size.test ))) diff --git a/stdlib/source/test/lux/abstract/mix.lux b/stdlib/source/test/lux/algorithm/mix.lux similarity index 100% rename from stdlib/source/test/lux/abstract/mix.lux rename to stdlib/source/test/lux/algorithm/mix.lux diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 9ffa388bc8..87e3671e2f 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -9,12 +9,13 @@ [monad (.only do)] ["[0]" functor ["[1]T" \\test (.only Injection)]] - ["[0]" mix (.only Mix) - ["[1]T" \\test]] ["[0]" monoid ["[1]T" \\test]] ["[0]" equivalence ["[1]T" \\test]]] + [algorithm + ["[0]" mix (.only Mix) + ["[1]T" \\test]]] [control ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try]] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 3fe572f012..b7a98fbcb7 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -14,12 +14,13 @@ ["[1]T" \\test]] ["[0]" monoid ["[1]T" \\test]] - ["[0]" mix - ["[1]T" \\test]] ["[0]" equivalence ["[1]T" \\test]] ["[0]" hash ["[1]T" \\test]]] + [algorithm + ["[0]" mix + ["[1]T" \\test]]] [control ["[0]" pipe] ["[0]" io] diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 14c60cbd27..510eab8265 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -13,10 +13,11 @@ ["[1]T" \\test]] ["[0]" monoid ["[1]T" \\test]] - ["[0]" mix - ["[1]T" \\test]] ["[0]" equivalence ["[1]T" \\test]]] + [algorithm + ["[0]" mix + ["[1]T" \\test]]] [control ["[0]" try (.only Try)] ["[0]" exception] diff --git a/stdlib/source/test/lux/data/collection/tree.lux b/stdlib/source/test/lux/data/collection/tree.lux index 32e093b749..05ae82be39 100644 --- a/stdlib/source/test/lux/data/collection/tree.lux +++ b/stdlib/source/test/lux/data/collection/tree.lux @@ -8,10 +8,11 @@ ["[0]" monad (.only do)] ["[0]" functor ["[1]T" \\test (.only Injection Comparison)]] - ["[0]" mix - ["[1]T" \\test]] ["[0]" equivalence ["[1]T" \\test]]] + [algorithm + ["[0]" mix + ["[1]T" \\test]]] [control ["//" parser] ["[0]" try] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 1550bd55dc..370c6906dc 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -46,7 +46,7 @@ ["[0]" int] ["[0]" rev] ["[0]" dec] - ["[0]" ratio]] + ["[0]" frac]] [arithmetic ["[0]" modular]]] [meta @@ -124,7 +124,7 @@ [\\format.int int.decimal random.int] [\\format.rev rev.decimal random.rev] [\\format.dec dec.decimal random.dec] - [\\format.ratio ratio.codec random.ratio] + [\\format.frac frac.codec random.frac] [\\format.symbol symbol.absolute ($//symbol.random 5 5)] [\\format.xml xml.codec $//xml.random] [\\format.json json.codec $//json.random] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index d0315f980c..7b99784ad1 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -24,7 +24,7 @@ [math ["[0]" random (.only Random)] [number - [ratio (.only Ratio)]]] + [frac (.only Frac)]]] [meta ["[0]" type] ["[0]" code (.only) @@ -50,7 +50,7 @@ ["[1][0]" xml]]] [math [number - ["[1][0]" ratio]]] + ["[1][0]" frac]]] [meta ["[1][0]" code] ["[1][0]" location] @@ -115,7 +115,7 @@ (the can_represent_complex_types (Random Bit) (do random.monad - [sample_ratio $//ratio.random + [sample_frac $//frac.random sample_symbol ($//symbol.random 5 5) sample_location $//location.random sample_type ($//type.random 0) @@ -127,7 +127,7 @@ (try#each (text#= ( ))) (try.else false))] - [Ratio %.ratio sample_ratio] + [Frac %.frac sample_frac] [Symbol %.symbol sample_symbol] [Location %.location sample_location] [Code %.code sample_code] diff --git a/stdlib/source/test/lux/math.lux b/stdlib/source/test/lux/math.lux index f97dcff5c1..32ad397b0c 100644 --- a/stdlib/source/test/lux/math.lux +++ b/stdlib/source/test/lux/math.lux @@ -15,7 +15,7 @@ ["i" int] ["r" rev] ["d" dec] - ["[0]" ratio (.only Ratio)] + ["[0]" frac (.only Frac)] ["[0]" complex (.only Complex)]]] [meta [macro @@ -41,9 +41,9 @@ ["[1]/[0]" circle] ["[1]/[0]" hyperbola]]]) -(the ratio/0 - Ratio - [ratio.#numerator 0 ratio.#denominator 1]) +(the frac/0 + Frac + [frac.#numerator 0 frac.#denominator 1]) (the complex/0 Complex @@ -65,8 +65,8 @@ parameterF (random.only (|>> (d.= +0.0) not) random.safe_dec) subjectF random.safe_dec - parameter/ (random.only (|>> (ratio.= ratio/0) not) random.ratio) - subject/ random.ratio + parameter/ (random.only (|>> (frac.= frac/0) not) random.frac) + subject/ random.frac parameterC (random.only (|>> (complex.= complex/0) not) random.complex) subjectC random.complex]) @@ -84,31 +84,31 @@ [i.= i.+ parameterI subjectI] [r.= r.+ parameterR subjectR] [d.= d.+ parameterF subjectF] - [ratio.= ratio.+ parameter/ subject/] + [frac.= frac.+ parameter/ subject/] [complex.= complex.+ parameterC subjectC]]] [/.- [[n.= n.- parameterN subjectN] [i.= i.- parameterI subjectI] [r.= r.- parameterR subjectR] [d.= d.- parameterF subjectF] - [ratio.= ratio.- parameter/ subject/] + [frac.= frac.- parameter/ subject/] [complex.= complex.- parameterC subjectC]]] [/.* [[n.= n.* parameterN subjectN] [i.= i.* parameterI subjectI] [r.= r.* parameterR subjectR] [d.= d.* parameterF subjectF] - [ratio.= ratio.* parameter/ subject/] + [frac.= frac.* parameter/ subject/] [complex.= complex.* parameterC subjectC]]] [/./ [[n.= n./ parameterN subjectN] [i.= i./ parameterI subjectI] [r.= r./ parameterR subjectR] [d.= d./ parameterF subjectF] - [ratio.= ratio./ parameter/ subject/] + [frac.= frac./ parameter/ subject/] [complex.= complex./ parameterC subjectC]]] [/.% [[n.= n.% parameterN subjectN] [i.= i.% parameterI subjectI] [r.= r.% parameterR subjectR] [d.= d.% parameterF subjectF] - [ratio.= ratio.% parameter/ subject/] + [frac.= frac.% parameter/ subject/] [complex.= complex.% parameterC subjectC]]] )) (,, (with_template [ '] @@ -124,28 +124,28 @@ [i.= parameterI subjectI] [r.= parameterR subjectR] [d.= parameterF subjectF] - [ratio.= parameter/ subject/] + [frac.= parameter/ subject/] [complex.= parameterC subjectC]]] [/.< [[n.< parameterN subjectN] [i.< parameterI subjectI] [r.< parameterR subjectR] [d.< parameterF subjectF] - [ratio.< parameter/ subject/]]] + [frac.< parameter/ subject/]]] [/.<= [[n.<= parameterN subjectN] [i.<= parameterI subjectI] [r.<= parameterR subjectR] [d.<= parameterF subjectF] - [ratio.<= parameter/ subject/]]] + [frac.<= parameter/ subject/]]] [/.> [[n.> parameterN subjectN] [i.> parameterI subjectI] [r.> parameterR subjectR] [d.> parameterF subjectF] - [ratio.> parameter/ subject/]]] + [frac.> parameter/ subject/]]] [/.>= [[n.>= parameterN subjectN] [i.>= parameterI subjectI] [r.>= parameterR subjectR] [d.>= parameterF subjectF] - [ratio.>= parameter/ subject/]]] + [frac.>= parameter/ subject/]]] )) /modulus.test diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux index 6a2c8d401f..e2ef19a435 100644 --- a/stdlib/source/test/lux/math/number.lux +++ b/stdlib/source/test/lux/math/number.lux @@ -32,7 +32,7 @@ ["[1][0]" int] ["[1][0]" rev] ["[1][0]" dec] - ["[1][0]" ratio] + ["[1][0]" frac] ["[1][0]" complex]]) (the without_commas @@ -142,6 +142,6 @@ /int.test /rev.test /dec.test - /ratio.test + /frac.test /complex.test )))) diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/frac.lux similarity index 86% rename from stdlib/source/test/lux/math/number/ratio.lux rename to stdlib/source/test/lux/math/number/frac.lux index 7d8093aadb..42c45a20da 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -37,15 +37,15 @@ random.nat)) (the .public random - (Random /.Ratio) + (Random /.Frac) (do random.monad [numerator ..part denominator (random.only (|>> (n.= 0) not) ..part)] - (in (/.ratio numerator denominator)))) + (in (/.frac numerator denominator)))) (the (identical? reference exemplar) - (-> /.Ratio /.Ratio + (-> /.Frac /.Frac Bit) (and (n.= (its /.#numerator reference) (its /.#numerator exemplar)) @@ -53,14 +53,14 @@ (its /.#denominator exemplar)))) (the (normal? it) - (-> /.Ratio + (-> /.Frac Bit) (identical? it (/.normal it))) (the .public test Test (<| (_.covering /._) - (_.for [/.Ratio + (_.for [/.Frac /.#numerator /.#denominator]) (`` (all _.and (_.for [/.equivalence /.=] @@ -83,9 +83,9 @@ [.let [(open "/#[0]") /.equivalence] denom/0 ..part denom/1 ..part] - (_.coverage [/.ratio] - (/#= (/.ratio 0 denom/0) - (/.ratio 0 denom/1)))) + (_.coverage [/.frac] + (/#= (/.frac 0 denom/0) + (/.frac 0 denom/1)))) (do [! random.monad] [.let [(open "/#[0]") /.equivalence] before_normal (random.and ..part ..part)] @@ -100,19 +100,19 @@ ..part)] (_.coverage [/.nat] (let [only_numerator! - (|> (/.ratio numerator) + (|> (/.frac numerator) /.nat (maybe#each (n#= numerator)) (maybe.else false)) denominator_1! - (|> (/.ratio numerator 1) + (|> (/.frac numerator 1) /.nat (maybe#each (n#= numerator)) (maybe.else false)) with_denominator! - (when (/.nat (/.ratio numerator denominator)) + (when (/.nat (/.frac numerator denominator)) {try.#Success factor} (and (n.= 0 (n.% denominator numerator)) (n.= numerator (n.* factor denominator))) @@ -126,17 +126,17 @@ [sample ..random] (all _.and (_.coverage [/.-] - (and (/.= (/.ratio 0) (/.- sample sample)) - (/.= sample (/.- (/.ratio 0) sample)))) + (and (/.= (/.frac 0) (/.- sample sample)) + (/.= sample (/.- (/.frac 0) sample)))) (_.coverage [/./] - (and (/.= (/.ratio 1) (/./ sample sample)) - (/.= sample (/./ (/.ratio 1) sample)))) + (and (/.= (/.frac 1) (/./ sample sample)) + (/.= sample (/./ (/.frac 1) sample)))) (_.coverage [/.reciprocal] - (/.= (/.ratio 1) + (/.= (/.frac 1) (/.* sample (/.reciprocal sample)))) )) (do random.monad - [left (random.only (|>> (/.= (/.ratio 0)) not) + [left (random.only (|>> (/.= (/.frac 0)) not) ..random) right ..random] (_.coverage [/.%] diff --git a/stdlib/source/test/lux/math/random.lux b/stdlib/source/test/lux/math/random.lux index 5a5054c70d..ce4f39a321 100644 --- a/stdlib/source/test/lux/math/random.lux +++ b/stdlib/source/test/lux/math/random.lux @@ -36,7 +36,7 @@ ["[0]" int] ["[0]" rev] ["[0]" dec] - ["[0]" ratio] + ["[0]" frac] ["[0]" complex]]] [meta [type @@ -142,7 +142,7 @@ [/.rev rev.equivalence] [/.safe_dec dec.equivalence] - [/.ratio ratio.equivalence] + [/.frac frac.equivalence] [/.complex complex.equivalence] [/.time time.equivalence] diff --git a/stdlib/source/test/lux/meta/type/unit/scale.lux b/stdlib/source/test/lux/meta/type/unit/scale.lux index 94b73f461e..2ff0ba2ac8 100644 --- a/stdlib/source/test/lux/meta/type/unit/scale.lux +++ b/stdlib/source/test/lux/meta/type/unit/scale.lux @@ -12,7 +12,7 @@ [number ["n" nat] ["i" int] - ["[0]" ratio (.use "[1]#[0]" equivalence)]]] + ["[0]" frac (.use "[1]#[0]" equivalence)]]] ["[0]" meta (.only) ["[0]" code] [macro @@ -32,8 +32,8 @@ (with_expansions [ (..natural) (..natural) (n.* )] - (these (the how (/.scale [ratio.#denominator - ratio.#numerator ])) + (these (the how (/.scale [frac.#denominator + frac.#numerator ])) (the How (/.type how)) (the how::from ) @@ -44,7 +44,7 @@ Test (<| (_.covering /._) (_.for [/.Scale - /.up /.down /.ratio]) + /.up /.down /.frac]) (do [! random.monad] [small (|> random.int (of ! each (i.% +1,000)) @@ -99,7 +99,7 @@ (is (//.Measure How //.Meter)) (of ..how down) (meter#= unscaled)) - (ratio#= [ratio.#denominator ..how::from - ratio.#numerator ..how::to] - (of ..how ratio)))) + (frac#= [frac.#denominator ..how::from + frac.#numerator ..how::to] + (of ..how frac)))) ))))) diff --git a/stdlib/source/test/lux/music/instrument.lux b/stdlib/source/test/lux/music/instrument.lux index e781b730fe..dcad1bed8e 100644 --- a/stdlib/source/test/lux/music/instrument.lux +++ b/stdlib/source/test/lux/music/instrument.lux @@ -14,169 +14,192 @@ ["[0]" random (.only Random)] [number ["[0]" nat]]] + [meta + [macro + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library ["[0]" /]]) -(with_expansions [ (these /.acoustic_grand_piano - /.bright_acoustic_piano - /.electric_grand_piano - /.honky_tonk_piano - /.electric_piano_1 - /.electric_piano_2 - /.harpsichord - /.clavinet - - /.celesta - /.glockenspiel - /.music_box - /.vibraphone - /.marimba - /.xylophone - /.tubular_bells - /.dulcimer - - /.drawbar_organ - /.percussive_organ - /.rock_organ - /.church_organ - /.reed_organ - /.accordion - /.harmonica - /.bandoneon - - /.nylon_acoustic_guitar - /.steel_acoustic_guitar - /.jazz_electric_guitar - /.clean_electric_guitar - /.muted_electric_guitar - /.overdriven_electric_guitar - /.distorted_electric_guitar - /.electric_guitar_harmonics - - /.acoustic_bass - /.fingered_electric_bass - /.picked_electric_bass - /.fretless_electric_bass - /.slap_bass_1 - /.slap_bass_2 - /.synth_bass_1 - /.synth_bass_2 - - /.violin - /.viola - /.cello - /.contrabass - /.tremolo_strings - /.pizzicato_strings - /.orchestral_harp - /.timpani - - /.string_ensemble_1 - /.string_ensemble_2 - /.synth_strings_1 - /.synth_strings_2 - /.choir_aahs - /.voice_oohs - /.synth_choir - /.orchestra_hit - - /.trumpet - /.trombone - /.tuba - /.muted_trumpet - /.french_horn - /.brass_section - /.synth_brass_1 - /.synth_brass_2 - - /.soprano_sax - /.alto_sax - /.tenor_sax - /.baritone_sax - /.oboe - /.english_horn - /.bassoon - /.clarinet - - /.piccolo - /.flute - /.recorder - /.pan_flute - /.blown_bottle - /.shakuhachi - /.whistle - /.ocarina - - /.square_wave - /.sawtooth_wave - /.triangle_wave - /.sine_wave - /.synth_charang - /.synth_voice - /.synth_fifths - /.synth_lead - - /.fantasia - /.warm_pad - /.polysynth - /.choir_pad - /.bowed_glass - /.metallic_pad - /.halo_pad - /.sweep_pad - - /.rain - /.soundtrack - /.crystal - /.atmosphere - /.brightness - /.goblins - /.echoes - /.sci-fi - - /.sitar - /.banjo - /.shamisen - /.koto - /.kalimba - /.bag_pipe - /.fiddle - /.shanai - - /.tinkle_bell - /.agogo - /.steel_drums - /.woodblock - /.taiko_drum - /.melodic_tom - /.synth_drum - /.reverse_cymbal - - /.guitar_fret_noise - /.breath_noise - /.seashore - /.bird_tweet - /.telephone_ring - /.helicopter - /.applause - /.gunshot - )] - (the .public test - Test - (<| (_.covering /._) - (do [! random.monad] - []) - (_.for [/.Instrument]) - (all _.and - (_.coverage [] - (let [options (is (List /.Instrument) - (list )) - uniques (set.of_list nat.hash options)] - (nat.= (list.size options) - (set.size uniques)))) - (_.coverage [/.santoor] - (same? /.dulcimer - /.santoor)) - )))) +(with_expansions [,bundles (these [[[/.acoustic_grand_piano] + [/.bright_acoustic_piano] + [/.electric_grand_piano] + [/.honky_tonk_piano] + [/.electric_piano_1] + [/.electric_piano_2] + [/.harpsichord] + [/.clavinet] + + [/.celesta] + [/.glockenspiel] + [/.music_box] + [/.vibraphone] + [/.marimba] + [/.xylophone] + [/.tubular_bells] + [/.dulcimer]]] + + [[[/.drawbar_organ] + [/.percussive_organ] + [/.rock_organ] + [/.church_organ] + [/.reed_organ] + [/.accordion] + [/.harmonica] + [/.bandoneon] + + [/.nylon_acoustic_guitar] + [/.steel_acoustic_guitar] + [/.jazz_electric_guitar] + [/.clean_electric_guitar] + [/.muted_electric_guitar] + [/.overdriven_electric_guitar] + [/.distorted_electric_guitar] + [/.electric_guitar_harmonics]]] + + [[[/.acoustic_bass] + [/.fingered_electric_bass] + [/.picked_electric_bass] + [/.fretless_electric_bass] + [/.slap_bass_1] + [/.slap_bass_2] + [/.synth_bass_1] + [/.synth_bass_2] + + [/.violin] + [/.viola] + [/.cello] + [/.contrabass] + [/.tremolo_strings] + [/.pizzicato_strings] + [/.orchestral_harp] + [/.timpani]]] + + [[[/.string_ensemble_1] + [/.string_ensemble_2] + [/.synth_strings_1] + [/.synth_strings_2] + [/.choir_aahs] + [/.voice_oohs] + [/.synth_choir] + [/.orchestra_hit] + + [/.trumpet] + [/.trombone] + [/.tuba] + [/.muted_trumpet] + [/.french_horn] + [/.brass_section] + [/.synth_brass_1] + [/.synth_brass_2]]] + + [[[/.soprano_sax] + [/.alto_sax] + [/.tenor_sax] + [/.baritone_sax] + [/.oboe] + [/.english_horn] + [/.bassoon] + [/.clarinet] + + [/.piccolo] + [/.flute] + [/.recorder] + [/.pan_flute] + [/.blown_bottle] + [/.shakuhachi] + [/.whistle] + [/.ocarina]]] + + [[[/.square_wave] + [/.sawtooth_wave] + [/.triangle_wave] + [/.sine_wave] + [/.synth_charang] + [/.synth_voice] + [/.synth_fifths] + [/.synth_lead] + + [/.fantasia] + [/.warm_pad] + [/.polysynth] + [/.choir_pad] + [/.bowed_glass] + [/.metallic_pad] + [/.halo_pad] + [/.sweep_pad]]] + + [[[/.rain] + [/.soundtrack] + [/.crystal] + [/.atmosphere] + [/.brightness] + [/.goblins] + [/.echoes] + [/.sci-fi] + + [/.sitar] + [/.banjo] + [/.shamisen] + [/.koto] + [/.kalimba] + [/.bag_pipe] + [/.fiddle] + [/.shanai]]] + + [[[/.tinkle_bell] + [/.agogo] + [/.steel_drums] + [/.woodblock] + [/.taiko_drum] + [/.melodic_tom] + [/.synth_drum] + [/.reverse_cymbal] + + [/.guitar_fret_noise] + [/.breath_noise] + [/.seashore] + [/.bird_tweet] + [/.telephone_ring] + [/.helicopter] + [/.applause] + [/.gunshot]]] + )] + (these (the all_options + (List /.Instrument) + (`` (`` (`` (list.together (list (,, (with_template [,options] + [(is (List /.Instrument) + (list (,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))))] + + ,bundles)))))))) + + (the .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (_.for [/.Instrument]) + (`` (all _.and + (,, (with_template [,options] + [(`` (`` (_.coverage [(,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))] + (let [uniques (set.of_list nat.hash ..all_options)] + (nat.= (list.size ..all_options) + (set.size uniques))))))] + + ,bundles)) + + (_.coverage [/.santoor] + (same? /.dulcimer + /.santoor)) + )))))) diff --git a/stdlib/source/test/lux/music/percussion.lux b/stdlib/source/test/lux/music/percussion.lux index 565d4dc6ee..ef3a217e22 100644 --- a/stdlib/source/test/lux/music/percussion.lux +++ b/stdlib/source/test/lux/music/percussion.lux @@ -14,88 +14,110 @@ ["[0]" random (.only Random)] [number ["[0]" nat (.use "[1]#[0]" equivalence)]]] + [meta + [macro + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library ["[0]" /]]) -(with_expansions [ (these /.snare_roll - /.finger_snap - /.high_q - /.slap - /.scratch_pull - /.scratch_push - /.sticks - /.square_click - /.metronome_bell - /.metronome_click - /.acoustic_bass_drum - /.electric_bass_drum - /.side_stick - /.acoustic_snare - /.hand_clap - /.electric_snare - /.low_floor_tom - /.closed_hi_hat - /.high_floor_tom - /.pedal_hi_hat - /.low_tom +(with_expansions [,bundles (these [[[/.snare_roll] + [/.finger_snap] + [/.high_q] + [/.slap] + [/.scratch_pull] + [/.scratch_push] + [/.sticks] + [/.square_click] + [/.metronome_bell] + [/.metronome_click] + [/.acoustic_bass_drum] + [/.electric_bass_drum] + [/.side_stick] + [/.acoustic_snare] + [/.hand_clap] + [/.electric_snare] + [/.low_floor_tom] + [/.closed_hi_hat] + [/.high_floor_tom] + [/.pedal_hi_hat] + [/.low_tom]]] - /.open_hi_hat - /.low_mid_tom - /.high_mid_tom - /.crash_cymbal_1 - /.high_tom - /.ride_cymbal_1 - /.chinese_cymbal - /.ride_bell - /.tambourine - /.splash_cymbal - /.cowbell - /.crash_cymbal_2 - /.vibraslap - /.ride_cymbal_2 - /.high_bongo - /.low_bongo - /.mute_high_conga - /.open_high_conga - /.low_conga - /.high_timbale - /.low_timbale + [[[/.open_hi_hat] + [/.low_mid_tom] + [/.high_mid_tom] + [/.crash_cymbal_1] + [/.high_tom] + [/.ride_cymbal_1] + [/.chinese_cymbal] + [/.ride_bell] + [/.tambourine] + [/.splash_cymbal] + [/.cowbell] + [/.crash_cymbal_2] + [/.vibraslap] + [/.ride_cymbal_2] + [/.high_bongo] + [/.low_bongo] + [/.mute_high_conga] + [/.open_high_conga] + [/.low_conga] + [/.high_timbale] + [/.low_timbale]]] - /.high_agogo - /.low_agogo - /.cabasa - /.maracas - /.short_whistle - /.long_whistle - /.short_guiro - /.long_guiro - /.claves - /.high_woodblock - /.low_woodblock - /.mute_cuica - /.open_cuica - /.mute_triangle - /.open_triangle - /.shaker - /.jingle_bell - /.belltree - /.castanets - /.mute_surdo - /.open_surdo - )] - (the .public test - Test - (<| (_.covering /._) - (do [! random.monad] - []) - (_.for [/.Instrument]) - (all _.and - (_.coverage [] - (let [options (is (List /.Instrument) - (list )) - uniques (set.of_list nat.hash options)] - (nat#= (list.size options) - (set.size uniques)))) - )))) + [[[/.high_agogo] + [/.low_agogo] + [/.cabasa] + [/.maracas] + [/.short_whistle] + [/.long_whistle] + [/.short_guiro] + [/.long_guiro] + [/.claves] + [/.high_woodblock] + [/.low_woodblock] + [/.mute_cuica] + [/.open_cuica] + [/.mute_triangle] + [/.open_triangle] + [/.shaker] + [/.jingle_bell] + [/.belltree] + [/.castanets] + [/.mute_surdo] + [/.open_surdo]]] + )] + (these (the all_options + (List /.Instrument) + (`` (`` (`` (list.together (list (,, (with_template [,options] + [(is (List /.Instrument) + (list (,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))))] + + ,bundles)))))))) + + (the .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (_.for [/.Instrument]) + (`` (all _.and + (,, (with_template [,options] + [(`` (`` (_.coverage [(,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))] + (let [uniques (set.of_list nat.hash ..all_options)] + (nat.= (list.size ..all_options) + (set.size uniques))))))] + + ,bundles)) + )))))) diff --git a/stdlib/source/test/lux/music/pitch.lux b/stdlib/source/test/lux/music/pitch.lux index a1ceaca8d4..2c527f368f 100644 --- a/stdlib/source/test/lux/music/pitch.lux +++ b/stdlib/source/test/lux/music/pitch.lux @@ -17,6 +17,9 @@ ["[0]" random (.only Random)] [number ["[0]" nat (.use "[1]#[0]" equivalence)]]] + [meta + [macro + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library @@ -35,145 +38,145 @@ /.a# /.b ) - (these /.c_0 - /.c#_0 - /.d_0 - /.d#_0 - /.e_0 - /.f_0 - /.f#_0 - /.g_0 - /.g#_0 - /.a_0 - /.a#_0 - /.b_0 - - /.c_1 - /.c#_1 - /.d_1 - /.d#_1 - /.e_1 - /.f_1 - /.f#_1 - /.g_1 - /.g#_1 - /.a_1 - /.a#_1 - /.b_1 - - /.c_2 - /.c#_2 - /.d_2 - /.d#_2 - /.e_2 - /.f_2 - /.f#_2 - /.g_2 - /.g#_2 - /.a_2 - /.a#_2 - /.b_2 - - /.c_3 - /.c#_3 - /.d_3 - /.d#_3 - /.e_3 - /.f_3 - /.f#_3 - /.g_3 - /.g#_3 - /.a_3 - /.a#_3 - /.b_3 - - /.c_4 - /.c#_4 - /.d_4 - /.d#_4 - /.e_4 - /.f_4 - /.f#_4 - /.g_4 - /.g#_4 - /.a_4 - /.a#_4 - /.b_4 - - /.c_5 - /.c#_5 - /.d_5 - /.d#_5 - /.e_5 - /.f_5 - /.f#_5 - /.g_5 - /.g#_5 - /.a_5 - /.a#_5 - /.b_5 - - /.c_6 - /.c#_6 - /.d_6 - /.d#_6 - /.e_6 - /.f_6 - /.f#_6 - /.g_6 - /.g#_6 - /.a_6 - /.a#_6 - /.b_6 - - /.c_7 - /.c#_7 - /.d_7 - /.d#_7 - /.e_7 - /.f_7 - /.f#_7 - /.g_7 - /.g#_7 - /.a_7 - /.a#_7 - /.b_7 - - /.c_8 - /.c#_8 - /.d_8 - /.d#_8 - /.e_8 - /.f_8 - /.f#_8 - /.g_8 - /.g#_8 - /.a_8 - /.a#_8 - /.b_8 - - /.c_9 - /.c#_9 - /.d_9 - /.d#_9 - /.e_9 - /.f_9 - /.f#_9 - /.g_9 - /.g#_9 - /.a_9 - /.a#_9 - /.b_9 - - /.c_10 - /.c#_10 - /.d_10 - /.d#_10 - /.e_10 - /.f_10 - /.f#_10 - /.g_10 - )] + ,bundles (these [[[/.c_0] + [/.c#_0] + [/.d_0] + [/.d#_0] + [/.e_0] + [/.f_0] + [/.f#_0] + [/.g_0] + [/.g#_0] + [/.a_0] + [/.a#_0] + [/.b_0] + + [/.c_1] + [/.c#_1] + [/.d_1] + [/.d#_1] + [/.e_1] + [/.f_1] + [/.f#_1] + [/.g_1] + [/.g#_1] + [/.a_1] + [/.a#_1] + [/.b_1]]] + + [[[/.c_2] + [/.c#_2] + [/.d_2] + [/.d#_2] + [/.e_2] + [/.f_2] + [/.f#_2] + [/.g_2] + [/.g#_2] + [/.a_2] + [/.a#_2] + [/.b_2] + + [/.c_3] + [/.c#_3] + [/.d_3] + [/.d#_3] + [/.e_3] + [/.f_3] + [/.f#_3] + [/.g_3] + [/.g#_3] + [/.a_3] + [/.a#_3] + [/.b_3]]] + + [[[/.c_4] + [/.c#_4] + [/.d_4] + [/.d#_4] + [/.e_4] + [/.f_4] + [/.f#_4] + [/.g_4] + [/.g#_4] + [/.a_4] + [/.a#_4] + [/.b_4] + + [/.c_5] + [/.c#_5] + [/.d_5] + [/.d#_5] + [/.e_5] + [/.f_5] + [/.f#_5] + [/.g_5] + [/.g#_5] + [/.a_5] + [/.a#_5] + [/.b_5]]] + + [[[/.c_6] + [/.c#_6] + [/.d_6] + [/.d#_6] + [/.e_6] + [/.f_6] + [/.f#_6] + [/.g_6] + [/.g#_6] + [/.a_6] + [/.a#_6] + [/.b_6] + + [/.c_7] + [/.c#_7] + [/.d_7] + [/.d#_7] + [/.e_7] + [/.f_7] + [/.f#_7] + [/.g_7] + [/.g#_7] + [/.a_7] + [/.a#_7] + [/.b_7]]] + + [[[/.c_8] + [/.c#_8] + [/.d_8] + [/.d#_8] + [/.e_8] + [/.f_8] + [/.f#_8] + [/.g_8] + [/.g#_8] + [/.a_8] + [/.a#_8] + [/.b_8] + + [/.c_9] + [/.c#_9] + [/.d_9] + [/.d#_9] + [/.e_9] + [/.f_9] + [/.f#_9] + [/.g_9] + [/.g#_9] + [/.a_9] + [/.a#_9] + [/.b_9]]] + + [[[/.c_10] + [/.c#_10] + [/.d_10] + [/.d#_10] + [/.e_10] + [/.f_10] + [/.f#_10] + [/.g_10]]] + )] (these (the .public class (Random /.Class) (let [options (is (Sequence /.Class) @@ -183,10 +186,23 @@ [choice (of ! each (nat.% amount) random.nat)] (in (maybe.trusted (sequence.item choice options)))))) + (the all_options + (List /.Pitch) + (`` (`` (`` (list.together (list (,, (with_template [,options] + [(is (List /.Pitch) + (list (,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))))] + + ,bundles)))))))) + (the .public random (Random /.Pitch) (let [options (is (Sequence /.Pitch) - (sequence )) + (sequence.of_list all_options)) amount (sequence.size options)] (do [! random.monad] [choice (of ! each (nat.% amount) random.nat)] @@ -219,21 +235,27 @@ (nat.= expected_class) not)))))) (<| (_.for [/.Pitch]) - (all _.and - (_.coverage [] - (let [options (is (List /.Pitch) - (list )) - uniques (set.of_list nat.hash options)] - (nat#= (list.size options) - (set.size uniques)))) - (_.coverage [/.Octave - /.pitch /.octave /.class] - (nat#= expected_pitch - (/.pitch (/.octave expected_pitch) - (/.class expected_pitch)))) - (_.coverage [/.lowest] - (not (nat.< /.lowest expected_pitch))) - (_.coverage [/.highest] - (not (nat.> /.highest expected_pitch))) - )) + (`` (all _.and + (,, (with_template [,options] + [(`` (`` (_.coverage [(,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))] + (let [uniques (set.of_list nat.hash ..all_options)] + (nat.= (list.size ..all_options) + (set.size uniques))))))] + + ,bundles)) + (_.coverage [/.Octave + /.pitch /.octave /.class] + (nat#= expected_pitch + (/.pitch (/.octave expected_pitch) + (/.class expected_pitch)))) + (_.coverage [/.lowest] + (not (nat.< /.lowest expected_pitch))) + (_.coverage [/.highest] + (not (nat.> /.highest expected_pitch))) + ))) ))))) diff --git a/stdlib/source/test/lux/music/scale.lux b/stdlib/source/test/lux/music/scale.lux index 0d14afca4e..7972388889 100644 --- a/stdlib/source/test/lux/music/scale.lux +++ b/stdlib/source/test/lux/music/scale.lux @@ -24,6 +24,9 @@ ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number ["[0]" nat]]] + [meta + [macro + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library @@ -32,49 +35,49 @@ ["[0]" interval (.only) ["[1]T" \\test]]]]) -(with_expansions [ (these /.chromatic - - /.major_pentatonic - /.suspended_pentatonic - /.blues_minor - /.blues_major - /.minor_pentatonic - /.balinese - /.chinese - /.japanese_hirajoshi - /.japanese_iwato - /.japanese_in_sen - - /.blues - /.augmented - /.iberian - /.mystic - /.whole_tone - - /.harmonic_major - /.harmonic_minor - /.melodic_minor - /.byzantine - /.enigmatic - /.hungarian - /.neapolitan - /.oriental - /.romanian_minor - /.spanish_gypsy - /.persian - /.arabic - /.super_locrian - /.hindu - /.lydian_dominant - /.major - /.minor - - /.diminished - /.bebop - /.algerian - /.eight_tone - - /.nine_tone +(with_expansions [,bundles (these [[[/.chromatic] + + [/.major_pentatonic] + [/.suspended_pentatonic] + [/.blues_minor] + [/.blues_major] + [/.minor_pentatonic] + [/.balinese] + [/.chinese] + [/.japanese_hirajoshi] + [/.japanese_iwato] + [/.japanese_in_sen] + + [/.blues] + [/.augmented] + [/.iberian] + [/.mystic] + [/.whole_tone]]] + + [[[/.harmonic_major] + [/.harmonic_minor] + [/.melodic_minor] + [/.byzantine] + [/.enigmatic] + [/.hungarian] + [/.neapolitan] + [/.oriental] + [/.romanian_minor] + [/.spanish_gypsy] + [/.persian] + [/.arabic] + [/.super_locrian] + [/.hindu] + [/.lydian_dominant] + [/.major] + [/.minor]]] + + [[[/.diminished] + [/.bebop] + [/.algerian] + [/.eight_tone] + + [/.nine_tone]]] ) (these /.tonic /.super_tonic @@ -84,10 +87,23 @@ /.sub_mediant /.leading )] - (these (the .public random + (these (the all_options + (List /.Scale) + (`` (`` (`` (list.together (list (,, (with_template [,options] + [(is (List /.Scale) + (list (,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))))] + + ,bundles)))))))) + + (the .public random (Random /.Scale) (let [options (is (Sequence /.Scale) - (sequence )) + (sequence.of_list all_options)) amount (sequence.size options)] (do [! random.monad] [choice (of ! each (nat.% amount) random.nat)] @@ -140,12 +156,18 @@ _ false))) - (_.coverage [] - (let [options (is (List /.Scale) - (list )) - uniques (set.of_list /.hash options)] - (nat.= (list.size options) - (set.size uniques)))) + (,, (with_template [,options] + [(`` (`` (_.coverage [(,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))] + (let [uniques (set.of_list /.hash ..all_options)] + (nat.= (list.size ..all_options) + (set.size uniques))))))] + + ,bundles)) (,, (with_template [ ] [(_.coverage [] (same? diff --git a/stdlib/source/test/lux/web/dom/event.lux b/stdlib/source/test/lux/web/dom/event.lux index 164a627f2c..3be903f09a 100644 --- a/stdlib/source/test/lux/web/dom/event.lux +++ b/stdlib/source/test/lux/web/dom/event.lux @@ -15,160 +15,181 @@ ["[0]" random (.only Random)] [number ["n" nat]]] + [meta + [macro + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library ["[0]" /]]) -(with_expansions [ (with_template [] - [] +(with_expansions [,bundles (these [[[/.copy] + [/.cut] + [/.dom_content_loaded] + [/.fullscreen_change] + [/.fullscreen_error] + [/.lost_pointer_capture] + [/.paste] + [/.pointer_lock_change] + [/.pointer_lock_error] + [/.ready_state_change] + [/.scroll] + [/.scroll_end] + [/.selection_change] + [/.visibility_change]]] - [/.copy] - [/.cut] - [/.dom_content_loaded] - [/.fullscreen_change] - [/.fullscreen_error] - [/.lost_pointer_capture] - [/.paste] - [/.pointer_lock_change] - [/.pointer_lock_error] - [/.ready_state_change] - [/.scroll] - [/.scroll_end] - [/.selection_change] - [/.visibility_change] + [[[/.animation_cancel] + [/.animation_end] + [/.animation_iteration] + [/.animation_start] + [/.aux_click] + [/.blur] + [/.click] + [/.composition_end] + [/.composition_start] + [/.composition_update] + [/.context_menu] + [/.double_click] + [/.focus] + [/.focus_in] + [/.focus_out] + [/.got_pointer_capture] + [/.key_down] + [/.key_up]]] + + [[[/.mouse_down] + [/.mouse_enter] + [/.mouse_leave] + [/.mouse_move] + [/.mouse_out] + [/.mouse_over] + [/.mouse_up] + [/.pointer_cancel] + [/.pointer_down] + [/.pointer_enter] + [/.pointer_leave] + [/.pointer_move] + [/.pointer_out] + [/.pointer_over] + [/.pointer_up] + [/.security_policy_violation] + [/.touch_cancel] + [/.touch_end] + [/.touch_move] + [/.touch_start] + [/.transition_cancel] + [/.transition_end] + [/.transition_run] + [/.transition_start] + [/.wheel]]] - [/.animation_cancel] - [/.animation_end] - [/.animation_iteration] - [/.animation_start] - [/.aux_click] - [/.blur] - [/.click] - [/.composition_end] - [/.composition_start] - [/.composition_update] - [/.context_menu] - [/.double_click] - [/.focus] - [/.focus_in] - [/.focus_out] - [/.got_pointer_capture] - [/.key_down] - [/.key_up] - [/.mouse_down] - [/.mouse_enter] - [/.mouse_leave] - [/.mouse_move] - [/.mouse_out] - [/.mouse_over] - [/.mouse_up] - [/.pointer_cancel] - [/.pointer_down] - [/.pointer_enter] - [/.pointer_leave] - [/.pointer_move] - [/.pointer_out] - [/.pointer_over] - [/.pointer_up] - [/.security_policy_violation] - [/.touch_cancel] - [/.touch_end] - [/.touch_move] - [/.touch_start] - [/.transition_cancel] - [/.transition_end] - [/.transition_run] - [/.transition_start] - [/.wheel] + [[[/.abort] + [/.load_end] + [/.load_start] + [/.progress] - [/.abort] - [/.load_end] - [/.load_start] - [/.progress] + [/.webgl_context_creation_error] + [/.webgl_context_lost] + [/.webgl_context_restored] - [/.webgl_context_creation_error] - [/.webgl_context_lost] - [/.webgl_context_restored] + [/.toggle] - [/.toggle] + [/.cancel] + [/.close] - [/.cancel] - [/.close] + [/.beforeinput] + [/.change] + [/.input] - [/.beforeinput] - [/.change] - [/.input] + [/.form_data] + [/.reset] + [/.submit] - [/.form_data] - [/.reset] - [/.submit] + [/.invalid] + [/.select]]] - [/.invalid] - [/.select] + [[[/.can_play_through] + [/.can_play] + [/.duration_change] + [/.emptied] + [/.ended] + [/.loaded_data] + [/.loaded_meta_data] + [/.pause] + [/.playing] + [/.play] + [/.rate_change] + [/.seeked] + [/.seeking] + [/.stalled] + [/.suspend] + [/.time_update] + [/.volume_change] + [/.waiting] - [/.can_play_through] - [/.can_play] - [/.duration_change] - [/.emptied] - [/.ended] - [/.loaded_data] - [/.loaded_meta_data] - [/.pause] - [/.playing] - [/.play] - [/.rate_change] - [/.seeked] - [/.seeking] - [/.stalled] - [/.suspend] - [/.time_update] - [/.volume_change] - [/.waiting] + [/.cue_change] - [/.cue_change] + [/.enter_picture_in_picture] + [/.leave_picture_in_picture]]] + + [[[/.after_print] + [/.app_installed] + [/.before_install_prompt] + [/.before_print] + [/.before_unload] + [/.device_motion] + [/.device_orientation] + [/.device_orientation_absolute] + [/.error] + [/.game_pad_connected] + [/.game_pad_disconnected] + [/.hash_change] + [/.language_change] + [/.load] + [/.message] + [/.message_error] + [/.off_line] + [/.on_line] + [/.page_hide] + [/.page_show] + [/.pop_state] + [/.rejection_handled] + [/.resize] + [/.storage] + [/.unhandled_rejection] + [/.unload]]] + )] + (these (the all_options + (List /.Event) + (`` (`` (`` (list.together (list (,, (with_template [,options] + [(is (List /.Event) + (list (,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] - [/.enter_picture_in_picture] - [/.leave_picture_in_picture] - - [/.after_print] - [/.app_installed] - [/.before_install_prompt] - [/.before_print] - [/.before_unload] - [/.device_motion] - [/.device_orientation] - [/.device_orientation_absolute] - [/.error] - [/.game_pad_connected] - [/.game_pad_disconnected] - [/.hash_change] - [/.language_change] - [/.load] - [/.message] - [/.message_error] - [/.off_line] - [/.on_line] - [/.page_hide] - [/.page_show] - [/.pop_state] - [/.rejection_handled] - [/.resize] - [/.storage] - [/.unhandled_rejection] - [/.unload] - )] - (the .public test - Test - (<| (_.covering /._) - (do [! random.monad] - []) - (_.for [/.Event]) - (all _.and - (_.coverage [] - (let [all (is (List /.Event) - (list )) - uniques (set.of_list text.hash all)] - (n.= (list.size all) - (set.size uniques)))) - )))) + ,options' + ))))))] + + ,bundles)))))))) + + (the .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (_.for [/.Event]) + (`` (all _.and + (,, (with_template [,options] + [(`` (`` (_.coverage [(,, (with_expansions [,options' (template.spliced ,options)] + (,, (with_template [,name] + [,name] + + ,options' + ))))] + (let [uniques (set.of_list text.hash ..all_options)] + (n.= (list.size ..all_options) + (set.size uniques))))))] + + ,bundles)) + )) + )))) diff --git a/stdlib/source/test/lux/world/time/series.lux b/stdlib/source/test/lux/world/time/series.lux index 80966a01d4..9833516605 100644 --- a/stdlib/source/test/lux/world/time/series.lux +++ b/stdlib/source/test/lux/world/time/series.lux @@ -8,10 +8,11 @@ [monad (.only do)] ["[0]" functor ["[1]T" \\test (.only Injection)]] - ["[0]" mix - ["[1]T" \\test]] ["[0]" equivalence ["[1]T" \\test]]] + [algorithm + ["[0]" mix + ["[1]T" \\test]]] [control ["|" pipe] ["[0]" try (.use "[1]#[0]" functor)] diff --git a/to_do.md b/to_do.md index 98debfc40c..9bcecfaa66 100644 --- a/to_do.md +++ b/to_do.md @@ -31,19 +31,21 @@ 0. Extract the variable link-ring machinery being used by both the `control/logic` and `meta/type/check` modules into its own module. 0. Replace recursive type calls from `(0 "")` to `(0 0)` 0. Fix bug wherein private aliases in module `A` of public definitions in module `B` are seen in module `C`, if it imports `A`. -0. Re-name `Codec#format` to `injection` and `Codec#value` to `projection`. +0. Re-name `Codec#format` to `injection`, and `Codec#value` to `projection`. 0. Re-name `Codec` to `Embedding`. * [Embedding](https://en.wikipedia.org/wiki/Embedding) 0. Re-name `Format` to `Injection`. 0. Re-name `Parser` to `Projection`. -0. Re-name Ratio to Frac(tion). Then, introduce an integer-based alternative to Frac(tion) called Rat(tional). - * [Fraction](https://en.wikipedia.org/wiki/Fraction) +0. Introduce an integer-based alternative to `Frac`(tion) called `Rat`(tional). 0. Make type-normalization no longer confuse local type parameters with globally-defined types/macros. Remove instances of `(.except left right)`. ## Done -0. Re-name `check.subsumes?` to `check.subsumed?`. -0. Get rid of `Dec` encoding/decoding default extensions. +0. Move `abstract/mix` to `algorithm/mix`. +0. Re-name Ratio to Frac(tion). + * [Fraction](https://en.wikipedia.org/wiki/Fraction) +0. [(Commit)](https://github.com/LuxLang/lux/commit/9291b0f9e2799063ddb09d97bd0f7ebfaaac59ee) Re-name `check.subsumes?` to `check.subsumed?`. +0. [(Commit)](https://github.com/LuxLang/lux/commit/9291b0f9e2799063ddb09d97bd0f7ebfaaac59ee) Get rid of `Dec` encoding/decoding default extensions. 0. [(Commit)](https://github.com/LuxLang/lux/commit/6fff5228b1b92c9ee37a27b584be10547f337782) Re-name Frac(tion) to Dec(imal). * [Decimal](https://en.wikipedia.org/wiki/Decimal) 0. [(Commit)](https://github.com/LuxLang/lux/commit/6fff5228b1b92c9ee37a27b584be10547f337782) Implement polytypic counting/length via induction.