diff options
author | Eduardo Julian | 2018-07-14 02:59:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-14 02:59:41 -0400 |
commit | 0c0472862f5c1e543e6c5614a4cd112ac7d4cc13 (patch) | |
tree | a94c7cd4bf3c916296c5341c5fc043ca71acb184 /stdlib | |
parent | 69fefab57c40f323d759dc444dbcebad15071585 (diff) |
- New syntax for bit values: "#0" and "#1", instead of "false" and "true".
- Small improvements to lux-mode.
Diffstat (limited to 'stdlib')
120 files changed, 769 insertions, 757 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 2f2649758..226545576 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1,4 +1,3 @@ -## Basic types ("lux def" dummy-cursor ("lux check" (+2 (+0 "#Text" (+0)) (+2 (+0 "#I64" (+1 (+0 "#Nat" (+0)) (+0))) @@ -6,7 +5,7 @@ ["" +0 +0]) [["" +0 +0] (+10 (+1 [[["" +0 +0] (+7 ["lux" "export?"])] - [["" +0 +0] (+0 true)]] + [["" +0 +0] (+0 #1)]] (+0)))]) ## (type: Any @@ -16,9 +15,9 @@ (+8 (+0) (+4 +1))) [dummy-cursor (+10 (+1 [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "The type of things whose type does not matter. @@ -32,9 +31,9 @@ (+7 (+0) (+4 +1))) [dummy-cursor (+10 (+1 [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "The type of things whose type is unknown or undefined. @@ -54,9 +53,9 @@ (+9 (+4 +1) (+4 +0)))))) [dummy-cursor (+10 (+1 [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (+1 [[dummy-cursor (+7 ["lux" "tags"])] [dummy-cursor (+9 (+1 [dummy-cursor (+5 "Nil")] (+1 [dummy-cursor (+5 "Cons")] (+0))))]] (+1 [[dummy-cursor (+7 ["lux" "type-args"])] @@ -70,9 +69,9 @@ (+0 "#Bit" #Nil)) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Your standard, run-of-the-mill boolean values (as bits).")]] #Nil))))]) @@ -83,9 +82,9 @@ (+0 "#I64" (#Cons (+4 +1) #Nil)))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "64-bit integers without any semantics.")]] #Nil))))]) @@ -95,9 +94,9 @@ (+0 "#I64" (#Cons (+0 "#Nat" #Nil) #Nil))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Natural numbers (unsigned integers). @@ -109,9 +108,9 @@ (+0 "#I64" (#Cons (+0 "#Int" #Nil) #Nil))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Your standard, run-of-the-mill integer numbers.")]] #Nil))))]) @@ -121,9 +120,9 @@ (+0 "#I64" (#Cons (+0 "#Rev" #Nil) #Nil))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Fractional numbers that live in the interval [0,1). @@ -135,9 +134,9 @@ (+0 "#Frac" #Nil)) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] #Nil))))]) @@ -147,9 +146,9 @@ (+0 "#Text" #Nil)) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Your standard, run-of-the-mill string values.")]] #Nil))))]) @@ -159,9 +158,9 @@ (+2 Text Text)) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "An identifier. @@ -180,9 +179,9 @@ (+4 +1)))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "tags"])] [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "None")] (#Cons [dummy-cursor (+5 "Some")] #Nil)))]] (#Cons [[dummy-cursor (+7 ["lux" "type-args"])] @@ -238,9 +237,9 @@ ("lux check type" (+9 (+4 +1) (+4 +0))))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "tags"])] [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Primitive")] (#Cons [dummy-cursor (+5 "Sum")] @@ -257,7 +256,7 @@ (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "This type represents the data-structures that are used to specify types themselves.")]] (#Cons [[dummy-cursor (+7 ["lux" "type-rec?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] #Nil))))))]) ## (type: Cursor @@ -276,9 +275,9 @@ (#Cons [[dummy-cursor (+7 ["lux" "doc"])] [dummy-cursor (+5 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]] (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] #Nil)))))]) ## (type: (Ann m v) @@ -300,9 +299,9 @@ (#Cons [[dummy-cursor (+7 ["lux" "type-args"])] [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "m")] (#Cons [dummy-cursor (+5 "v")] #Nil)))]] (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] #Nil))))))]) ## (type: (Code' w) @@ -367,9 +366,9 @@ (#Cons [[dummy-cursor (+7 ["lux" "type-args"])] [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "w")] #Nil))]] (#Cons [[dummy-cursor (+7 ["lux" "type?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "export?"])] - [dummy-cursor (+0 true)]] + [dummy-cursor (+0 #1)]] #Nil)))))]) ## (type: Code @@ -383,9 +382,9 @@ (#Record (#Cons [[dummy-cursor (#Tag ["lux" "doc"])] [dummy-cursor (#Text "The type of Code nodes for Lux syntax.")]] (#Cons [[dummy-cursor (#Tag ["lux" "type?"])] - [dummy-cursor (#Bit true)]] + [dummy-cursor (#Bit #1)]] (#Cons [[dummy-cursor (#Tag ["lux" "export?"])] - [dummy-cursor (#Bit true)]] + [dummy-cursor (#Bit #1)]] #Nil))))]) ("lux def" _ann @@ -459,16 +458,16 @@ ("lux def" default-def-meta-exported ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "type?"]) - (bit$ true)] + (bit$ #1)] (#Cons [(tag$ ["lux" "export?"]) - (bit$ true)] + (bit$ #1)] #Nil))) (record$ #Nil)) ("lux def" default-def-meta-unexported ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "type?"]) - (bit$ true)] + (bit$ #1)] #Nil)) (record$ #Nil)) @@ -808,7 +807,7 @@ ("lux def" default-macro-meta ("lux check" (#Apply (#Product Code Code) List) (#Cons [(tag$ ["lux" "macro?"]) - (bit$ true)] + (bit$ #1)] #Nil)) (record$ #Nil)) @@ -878,13 +877,13 @@ ("lux check" (#Function Text Code) ([_ tag] (tuple$ (#Cons [(meta-code ["lux" "Tag"] (tuple$ (#Cons (text$ "lux") (#Cons (text$ tag) #Nil)))) - (#Cons [(meta-code ["lux" "Bit"] (bit$ true)) + (#Cons [(meta-code ["lux" "Bit"] (bit$ #1)) #Nil])])))) (record$ #Nil)) ("lux def" export-meta ("lux check" (#Product Code Code) - [(tag$ ["lux" "export?"]) (bit$ true)]) + [(tag$ ["lux" "export?"]) (bit$ #1)]) (record$ #Nil)) ("lux def" export?-meta @@ -1090,10 +1089,10 @@ #None (#Cons [k v] env') - ({true + ({#1 (#Some v) - false + #0 (get-rep key env')} (text/= k key))} env)) @@ -1246,13 +1245,13 @@ (update-parameters body')) #Nil)))))) body names) - (return (#Cons ({[true _] + (return (#Cons ({[#1 _] body' [_ #Nil] body' - [false _] + [#0 _] (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))] #Nil) body')} @@ -1293,13 +1292,13 @@ (update-parameters body')) #Nil)))))) body names) - (return (#Cons ({[true _] + (return (#Cons ({[#1 _] body' [_ #Nil] body' - [false _] + [#0 _] (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))] #Nil) body')} @@ -1508,11 +1507,11 @@ (All [a] (-> (-> a Bit) ($' List a) Bit)) ({#Nil - false + #0 (#Cons x xs') - ({true true - false (any? p xs')} + ({#1 #1 + #0 (any? p xs')} (p x))} xs)) @@ -1718,14 +1717,14 @@ (list [(tag$ ["lux" "doc"]) (text$ "Picks which expression to evaluate based on a bit test value. - (if true + (if #1 \"Oh, yeah!\" \"Aw hell naw!\") => \"Oh, yeah!\"")]) ({(#Cons test (#Cons then (#Cons else #Nil))) - (return (list (form$ (list (record$ (list [(bit$ true) then] - [(bit$ false) else])) + (return (list (form$ (list (record$ (list [(bit$ #1) then] + [(bit$ #0) else])) test)))) _ @@ -1786,7 +1785,7 @@ ({[_ (#Record def-meta)] ({(#Cons [key value] def-meta') ({[_ (#Tag [prefix' name'])] - ({[true true] + ({[#1 #1] (#Some value) _ @@ -1834,7 +1833,7 @@ (def:''' (splice replace? untemplate elems) #Nil (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) - ({true + ({#1 ({#Nil (return (tag$ ["lux" "Nil"])) @@ -1865,7 +1864,7 @@ lastO inits))} (list/reverse elems)) - false + #0 (do Monad<Meta> [=elems (monad/map Monad<Meta> untemplate elems)] (wrap (untemplate-list =elems)))} @@ -1897,10 +1896,10 @@ [_ [_ (#Text value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Text"]) (text$ value))))) - [false [_ (#Tag [module name])]] + [#0 [_ (#Tag [module name])]] (return (wrap-meta (form$ (list (tag$ ["lux" "Tag"]) (tuple$ (list (text$ module) (text$ name))))))) - [true [_ (#Tag [module name])]] + [#1 [_ (#Tag [module name])]] (let' [module' ({"" subst @@ -1909,7 +1908,7 @@ module)] (return (wrap-meta (form$ (list (tag$ ["lux" "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) - [true [_ (#Symbol [module name])]] + [#1 [_ (#Symbol [module name])]] (do Monad<Meta> [real-name ({"" (if (text/= "" subst) @@ -1922,13 +1921,13 @@ #let [[module name] real-name]] (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))) - [false [_ (#Symbol [module name])]] + [#0 [_ (#Symbol [module name])]] (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name))))))) - [true [_ (#Form (#Cons [[_ (#Symbol ["" "~"])] (#Cons [unquoted #Nil])]))]] + [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~"])] (#Cons [unquoted #Nil])]))]] (return unquoted) - [true [_ (#Form (#Cons [[_ (#Symbol ["" "~!"])] (#Cons [dependent #Nil])]))]] + [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~!"])] (#Cons [dependent #Nil])]))]] (do Monad<Meta> [independent (untemplate replace? subst dependent)] (wrap (wrap-meta (form$ (list (tag$ ["lux" "Form"]) @@ -1936,8 +1935,8 @@ (untemplate-text subst) independent))))))) - [true [_ (#Form (#Cons [[_ (#Symbol ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] - (untemplate false subst keep-quoted) + [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] + (untemplate #0 subst keep-quoted) [_ [meta (#Form elems)]] (do Monad<Meta> @@ -2006,7 +2005,7 @@ ({(#Cons template #Nil) (do Monad<Meta> [current-module current-module-name - =template (untemplate true current-module template)] + =template (untemplate #1 current-module template)] (wrap (list (form$ (list (text$ "lux check") (symbol$ ["lux" "Code"]) =template))))) @@ -2023,7 +2022,7 @@ (~ body))))")]) ({(#Cons template #Nil) (do Monad<Meta> - [=template (untemplate true "" template)] + [=template (untemplate #1 "" template)] (wrap (list (form$ (list (text$ "lux check") (symbol$ ["lux" "Code"]) =template))))) _ @@ -2036,7 +2035,7 @@ (' \"YOLO\")")]) ({(#Cons template #Nil) (do Monad<Meta> - [=template (untemplate false "" template)] + [=template (untemplate #0 "" template)] (wrap (list (form$ (list (text$ "lux check") (symbol$ ["lux" "Code"]) =template))))) _ @@ -2189,7 +2188,7 @@ #Nil (All [a] (-> (-> a Bit) ($' List a) Bit)) - (list/fold (function' [_2 _1] (if _1 (p _2) false)) true xs)) + (list/fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) (def:''' #export (n/= test subject) (list [(tag$ ["lux" "doc"]) @@ -2221,19 +2220,19 @@ (let' [testH (high-bits test) subjectH (high-bits subject)] (if ("lux int <" subjectH testH) - true + #1 (if ("lux i64 =" testH subjectH) ("lux int <" (low-bits subject) (low-bits test)) - false)))) + #0)))) (def:''' #export (n/<= test subject) (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) less-than-equal.")]) (-> Nat Nat Bit) (if (n/< test subject) - true + #1 ("lux i64 =" test subject))) (def:''' #export (n/> test subject) @@ -2247,7 +2246,7 @@ (text$ "Nat(ural) greater-than-equal.")]) (-> Nat Nat Bit) (if (n/< subject test) - true + #1 ("lux i64 =" test subject))) (macro:' #export (do-template tokens) @@ -2300,7 +2299,7 @@ (-> Rev Rev Bit) (if (n/< ("lux coerce" Nat test) ("lux coerce" Nat subject)) - true + #1 ("lux i64 =" test subject))) (def:''' #export (r/> test subject) @@ -2314,7 +2313,7 @@ (text$ "Rev(olution) greater-than-equal.")]) (-> Rev Rev Bit) (if (r/< subject test) - true + #1 ("lux i64 =" test subject))) (do-template [<type> @@ -2337,7 +2336,7 @@ (text$ <<=-doc>)]) (-> <type> <type> Bit) (if (<lt-proc> subject test) - true + #1 (<eq-proc> subject test))) (def:''' #export (<gt-name> test subject) @@ -2351,7 +2350,7 @@ (text$ <>=-doc>)]) (-> <type> <type> Bit) (if (<lt-proc> test subject) - true + #1 (<eq-proc> subject test)))] [ Int "lux i64 =" "lux int <" i/= i/< i/<= i/> i/>= @@ -2539,7 +2538,7 @@ (def:''' (bit/encode x) #Nil (-> Bit Text) - (if x "true" "false")) + (if x "#1" "#0")) (def:''' (digit-to-text digit) #Nil @@ -2607,11 +2606,11 @@ (list [(tag$ ["lux" "doc"]) (text$ "## Bit negation. - (not true) => false + (not #1) => #0 - (not false) => true")]) + (not #0) => #1")]) (-> Bit Bit) - (if x false true)) + (if x #0 #1)) (def:''' (find-macro' modules current-module module name) #Nil @@ -2623,8 +2622,8 @@ gdef (let' [{#module-hash _ #module-aliases _ #definitions bindings #imports _ #tags tags #types types #module-annotations _ #module-state _} ("lux check" Module $module)] (get name bindings))] (let' [[def-type def-meta def-value] ("lux check" Definition gdef)] - ({(#Some [_ (#Bit true)]) - ({(#Some [_ (#Bit true)]) + ({(#Some [_ (#Bit #1)]) + ({(#Some [_ (#Bit #1)]) (#Some ("lux coerce" Macro def-value)) _ @@ -2676,8 +2675,8 @@ (do Monad<Meta> [ident (normalize ident) output (find-macro ident)] - (wrap ({(#Some _) true - #None false} + (wrap ({(#Some _) #1 + #None #0} output)))) (def:''' (list/join xs) @@ -2859,8 +2858,8 @@ (def:''' (empty? xs) #Nil (All [a] (-> ($' List a) Bit)) - ({#Nil true - _ false} + ({#Nil #1 + _ #0} xs)) (do-template [<name> <type> <value>] @@ -2979,10 +2978,10 @@ (macro:' (def:' tokens) (let' [[export? tokens'] ({(#Cons [_ (#Tag ["" "export"])] tokens') - [true tokens'] + [#1 tokens'] _ - [false tokens]} + [#0 tokens]} tokens) parts (: (Maybe [Code (List Code) (Maybe Code) Code]) ({(#Cons [_ (#Form (#Cons name args))] (#Cons type (#Cons body #Nil))) @@ -3174,10 +3173,10 @@ (-> Weekday Bit) (case day (^or #Saturday #Sunday) - true + #1 _ - false))")]) + #0))")]) (case tokens (^ (list& [_ (#Form patterns)] body branches)) (case patterns @@ -3196,10 +3195,10 @@ (-> Code Bit) (case code [_ (#Symbol _)] - true + #1 _ - false)) + #0)) (macro:' #export (let tokens) (list [(tag$ ["lux" "doc"]) @@ -3333,10 +3332,10 @@ (-> (List Code) [Bit (List Code)]) (case tokens (#Cons [_ (#Tag [_ "export"])] tokens') - [true tokens'] + [#1 tokens'] _ - [false tokens])) + [#0 tokens])) (def:' (export ?) (-> Bit (List Code)) @@ -3466,7 +3465,7 @@ _ (` ((~ name) (~+ args))))] (return (list (` (..def: (~+ (export exported?)) (~ def-sig) - (~ (meta-code-merge (` {#.macro? true}) + (~ (meta-code-merge (` {#.macro? #1}) meta)) ..Macro @@ -3528,7 +3527,7 @@ (function (_ [m-name m-type]) [(tag$ ["" m-name]) m-type])) members)) - sig-meta (meta-code-merge (` {#.sig? true}) + sig-meta (meta-code-merge (` {#.sig? #1}) meta) usage (case args #Nil @@ -3569,8 +3568,8 @@ _ (fail <message>)))] - [and (if (~ pre) (~ post) false) "'and' requires >=1 clauses." "Short-circuiting \"and\".\n(and true false true) ## => false"] - [or (if (~ pre) true (~ post)) "'or' requires >=1 clauses." "Short-circuiting \"or\".\n(or true false true) ## => true"]) + [and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting \"and\".\n(and #1 #0 #1) ## => #0"] + [or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting \"or\".\n(or #1 #0 #1) ## => #1"]) (def: (index-of part text) (-> Text Text (Maybe Nat)) @@ -3952,7 +3951,7 @@ _ (` ((~ name) (~+ args))))] (return (list (` (..def: (~+ (export exported?)) (~ usage) - (~ (meta-code-merge (` {#.struct? true}) + (~ (meta-code-merge (` {#.struct? #1}) meta)) (~ type) (structure (~+ definitions))))))) @@ -3978,10 +3977,10 @@ (let [[exported? tokens'] (export^ tokens) [rec? tokens'] (case tokens' (#Cons [_ (#Tag [_ "rec"])] tokens') - [true tokens'] + [#1 tokens'] _ - [false tokens']) + [#0 tokens']) parts (: (Maybe [Text (List Code) Code (List Code)]) (case tokens' (^ (list [_ (#Symbol "" name)] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)])) @@ -4015,10 +4014,10 @@ (case tags?? (#Some tags) (` {#.tags [(~+ (list/map text$ tags))] - #.type? true}) + #.type? #1}) _ - (` {#.type? true}))) + (` {#.type? #1}))) type' (: (Maybe Code) (if rec? (if (empty? args) @@ -4038,7 +4037,7 @@ (#Some type'') (return (list (` (..def: (~+ (export exported?)) (~ type-name) (~ ($_ meta-code-merge (with-type-args args) - (if rec? (' {#.type-rec? true}) (' {})) + (if rec? (' {#.type-rec? #1}) (' {})) type-meta meta)) Type @@ -4236,7 +4235,7 @@ #let [[referral extra] referral+extra] openings+extra (parse-openings extra) #let [[openings extra] openings+extra] - sub-imports (parse-imports true import-name extra)] + sub-imports (parse-imports #1 import-name extra)] (wrap (list& {#import-name import-name #import-alias (#Some (replace-all "." m-name alias)) #import-refer {#refer-defs referral @@ -4250,7 +4249,7 @@ #let [[referral extra] referral+extra] openings+extra (parse-openings extra) #let [[openings extra] openings+extra] - sub-imports (parse-imports true import-name extra)] + sub-imports (parse-imports #1 import-name extra)] (wrap (case [referral openings] [#Nothing #Nil] sub-imports _ (list& {#import-name import-name @@ -4280,7 +4279,7 @@ (List Text)) (function (_ [name [def-type def-meta def-value]]) (case (get-meta ["lux" "export?"] def-meta) - (#Some [_ (#Bit true)]) + (#Some [_ (#Bit #1)]) (list name) _ @@ -4309,7 +4308,7 @@ (let [output (list/fold (function (_ case prev) (or prev (text/= case name))) - false + #0 cases)] output)) @@ -4882,7 +4881,7 @@ _ [(list) tokens]))] current-module current-module-name - imports (parse-imports false current-module _imports) + imports (parse-imports #0 current-module _imports) #let [=imports (list/map (: (-> Importation Code) (function (_ [m-name m-alias =refer]) (` [(~ (text$ m-name)) (~ (text$ (default "" m-alias)))]))) @@ -5523,20 +5522,20 @@ [<tests> (do-template [<expr> <text> <pattern>] [(compare <pattern> <expr>) (compare <text> (:: Code/encode show <expr>)) - (compare true (:: Equivalence<Code> = <expr> <expr>))] - - [(bit true) "true" [_ (#.Bit true)]] - [(bit false) "false" [_ (#.Bit false)]] - [(int 123) "123" [_ (#.Int 123)]] - [(frac 123.0) "123.0" [_ (#.Frac 123.0)]] - [(text "\n") "\"\\n\"" [_ (#.Text "\n")]] - [(tag ["yolo" "lol"]) "#yolo.lol" [_ (#.Tag ["yolo" "lol"])]] - [(symbol ["yolo" "lol"]) "yolo.lol" [_ (#.Symbol ["yolo" "lol"])]] - [(form (list (bit true) (int 123))) "(true 123)" (^ [_ (#.Form (list [_ (#.Bit true)] [_ (#.Int 123)]))])] - [(tuple (list (bit true) (int 123))) "[true 123]" (^ [_ (#.Tuple (list [_ (#.Bit true)] [_ (#.Int 123)]))])] - [(record (list [(bit true) (int 123)])) "{true 123}" (^ [_ (#.Record (list [[_ (#.Bit true)] [_ (#.Int 123)]]))])] - [(local-tag "lol") "#lol" [_ (#.Tag ["" "lol"])]] - [(local-symbol "lol") "lol" [_ (#.Symbol ["" "lol"])]] + (compare #1 (:: Equivalence<Code> = <expr> <expr>))] + + [(bit #1) "#1" [_ (#.Bit #1)]] + [(bit #0) "#0" [_ (#.Bit #0)]] + [(int 123) "123" [_ (#.Int 123)]] + [(frac 123.0) "123.0" [_ (#.Frac 123.0)]] + [(text "\n") "\"\\n\"" [_ (#.Text "\n")]] + [(tag ["yolo" "lol"]) "#yolo.lol" [_ (#.Tag ["yolo" "lol"])]] + [(symbol ["yolo" "lol"]) "yolo.lol" [_ (#.Symbol ["yolo" "lol"])]] + [(form (list (bit #1) (int 123))) "(#1 123)" (^ [_ (#.Form (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] + [(tuple (list (bit #1) (int 123))) "[#1 123]" (^ [_ (#.Tuple (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] + [(record (list [(bit #1) (int 123)])) "{#1 123}" (^ [_ (#.Record (list [[_ (#.Bit #1)] [_ (#.Int 123)]]))])] + [(local-tag "lol") "#lol" [_ (#.Tag ["" "lol"])]] + [(local-symbol "lol") "lol" [_ (#.Symbol ["" "lol"])]] )] (test-all <tests>))))} (case tokens @@ -5652,7 +5651,7 @@ (return [expr binding]) _ - (return [level (` true)]) + (return [level (` #1)]) )) (def: (multi-level-case^ levels) @@ -5684,7 +5683,7 @@ "Useful in situations where the result of a branch depends on further refinements on the values being matched." "For example:" (case (split (size static) uri) - (^multi (#.Some [chunk uri']) [(text/= static chunk) true]) + (^multi (#.Some [chunk uri']) [(text/= static chunk) #1]) (match-uri endpoint? parts' uri') _ @@ -6228,3 +6227,12 @@ (nat/encode line) separator (nat/encode column))] ($_ "lux text concat" "[" fields "]"))) + +(do-template [<zero> <one>] + [(def: #export <zero> #0) + (def: #export <one> #1)] + + [false true] + [no yes] + [off on] + ) diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index 570316334..cb35b0706 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -28,8 +28,8 @@ (exception: #export (dead {actor-name Text} {message-name Text}) - (format " Actor: " actor-name "\n" - "Message: " message-name "\n")) + (ex.report ["Actor" actor-name] + ["Message" message-name])) ## [Types] (with-expansions @@ -95,10 +95,10 @@ (All [s] (-> (Actor s) Bit)) (case (promise.poll (get@ #obituary (:representation actor))) #.None - true + #1 _ - false)) + #0)) (def: #export (send message actor) {#.doc "Communicate with an actor through message passing."} @@ -115,12 +115,12 @@ (if resolved? (do @ [_ (atom.write (product.right entry) (get@ #mailbox (:representation actor)))] - (wrap true)) + (wrap #1)) (recur |mailbox|))) (#.Some [_ |mailbox|']) (recur |mailbox|'))))) - (io/wrap false))) + (io/wrap #0))) )) ## [Values] diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 0a03b2c9e..eaf913ac1 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -36,7 +36,7 @@ [(^@ old [_value _observers]) (atom.read promise)] (case _value (#.Some _) - (wrap false) + (wrap #0) #.None (do @ @@ -46,7 +46,7 @@ (do @ [_ (monad.map @ (function (_ f) (f value)) _observers)] - (wrap true)) + (wrap #1)) (resolve value (:abstraction promise))))))) (def: #export (await f (^:representation promise)) @@ -68,10 +68,10 @@ (All [a] (-> (Promise a) Bit)) (case (poll promise) #.None - false + #0 (#.Some _) - true)) + #1)) (structure: #export _ (Functor Promise) (def: (map f fa) diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index 774acf5fa..b6c0ce69b 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -33,14 +33,14 @@ [state (atom.read semaphore) #let [[ready? state'] (: [Bit State] (case (get@ #open-positions state) - +0 [false (update@ #waiting-list (|>> (#.Cons signal)) - state)] - _ [true (update@ #open-positions dec - state)]))] + +0 [#0 (update@ #waiting-list (|>> (#.Cons signal)) + state)] + _ [#1 (update@ #open-positions dec + state)]))] success? (atom.compare-and-swap state state' semaphore) _ (if ready? (promise.resolve [] signal) - (wrap false))] + (wrap #0))] (if success? (wrap signal) (recur signal))))))) @@ -64,7 +64,7 @@ (do @ [_ (case ?signal #.None - (wrap true) + (wrap #1) (#.Some signal) (promise.resolve [] signal))] diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 7af73b68d..88d0ed6ed 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -187,7 +187,7 @@ (def: commit-processor-flag (Atom Bit) - (atom false)) + (atom #0)) (def: (issue-commit commit) (-> Commit (IO Any)) @@ -219,7 +219,7 @@ (if flag (wrap []) (do @ - [was-first? (atom.compare-and-swap flag true commit-processor-flag)] + [was-first? (atom.compare-and-swap flag #1 commit-processor-flag)] (if was-first? (exec (|> (io.run (atom.read pending-commits)) (promise.await (function (recur [head tail]) diff --git a/stdlib/source/lux/control/contract.lux b/stdlib/source/lux/control/contract.lux index 9b7427190..d7e054a9b 100644 --- a/stdlib/source/lux/control/contract.lux +++ b/stdlib/source/lux/control/contract.lux @@ -26,7 +26,7 @@ (syntax: #export (post test expr) {#.doc (doc "Post-conditions." "Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate." - "If the predicate returns true, returns the value of the expression." + "If the predicate returns #1, returns the value of the expression." "Otherwise, an error is raised." (post i/even? (i/+ 2 2)))} diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux index eb869a81c..dea0e3fa6 100644 --- a/stdlib/source/lux/control/equivalence.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -22,7 +22,7 @@ (:: right = b y) _ - false)))) + #0)))) (def: #export (rec sub) (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index a1084290a..a7de8246f 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -151,7 +151,7 @@ (or (singleton? reference) (and (inner? reference) (outer? sample))) - false + #0 ## (and (outer? reference) (inner? sample)) (let [(^open) reference] @@ -166,7 +166,7 @@ (let [(^open) reference] (and (not (:: Equivalence<Interval> = reference sample)) (cond (singleton? sample) - false + #0 (singleton? reference) (nested? sample reference) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 7ad46dba8..fc42d5976 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -60,7 +60,7 @@ ## [Parsers] (def: #export (assert message test) - {#.doc "Fails with the given message if the test is false."} + {#.doc "Fails with the given message if the test is #0."} (All [s] (-> Text Bit (Parser s Any))) (function (_ input) (if test diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux index 383d1b907..72fe8165f 100644 --- a/stdlib/source/lux/control/predicate.lux +++ b/stdlib/source/lux/control/predicate.lux @@ -18,8 +18,8 @@ (<composition> (left value) (right value))))] - [none false union or] - [all true intersection and] + [none #0 union or] + [all #1 intersection and] ) (do-template [<name> <identity> <composition>] diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index 60cef178b..65bfad034 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -18,8 +18,8 @@ (def: eq Equivalence<Bit>) (def: (hash value) (case value - true +1 - false +0))) + #1 +1 + #0 +0))) (do-template [<name> <identity> <op>] [(structure: #export <name> (Monoid Bit) @@ -27,21 +27,21 @@ (def: (compose x y) (<op> x y)))] - [ Or@Monoid<Bit> false or] - [And@Monoid<Bit> true and] + [ Or@Monoid<Bit> #0 or] + [And@Monoid<Bit> #1 and] ) (structure: #export _ (Codec Text Bit) (def: (encode x) (if x - "true" - "false")) + "#1" + "#0")) (def: (decode input) (case input - "true" (#.Right true) - "false" (#.Right false) - _ (#.Left "Wrong syntax for Bit.")))) + "#1" (#.Right #1) + "#0" (#.Right #0) + _ (#.Left "Wrong syntax for Bit.")))) ## [Values] (def: #export complement diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index d8d4ce5fa..a4fe01a35 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -161,14 +161,14 @@ (and prev (case [(read idx xs) (read idx ys)] [#.None #.None] - true + #1 [(#.Some x) (#.Some y)] (:: Equivalence<a> = x y) _ - false))) - true + #0))) + #1 (list.n/range +0 (dec sxs))))) )) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 24eaa44a6..05de58e37 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -98,7 +98,7 @@ ("lux i64 =" empty-chunk) .not) (recur (inc idx))) - false)))) + #0)))) (def: #export (not input) (-> Bits Bits) @@ -165,4 +165,4 @@ (..chunk idx reference) (..chunk idx sample)) (recur (inc idx))) - true))))) + #1))))) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 5add5c74a..27ee863cc 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -275,10 +275,10 @@ (All [k v] (-> (Node k v) Bit)) (`` (case node (#Base (~~ (static ..clean-bitmap)) _) - true + #1 _ - false))) + #0))) (def: (put' level hash key val Hash<k> node) (All [k v] (-> Level Hash-Code k v (Hash k) (Node k v) (Node k v))) @@ -571,8 +571,8 @@ (def: #export (contains? key dict) (All [k v] (-> k (Dictionary k v) Bit)) (case (get key dict) - #.None false - (#.Some _) true)) + #.None #0 + (#.Some _) #1)) (def: #export (put~ key val dict) {#.doc "Only puts the KV-pair if the key is not already present."} @@ -684,5 +684,5 @@ (:: Equivalence<v> = tk sk) _ - false)) + #0)) (keys test))))) diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 153c17a69..0af6bd341 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -77,7 +77,7 @@ (loop [node (get@ #root dict)] (case node #.None - false + #0 (#.Some node) (let [node-key (get@ #key node)] @@ -472,7 +472,7 @@ [?root found?] (loop [?root (get@ #root dict)] (case ?root #.None - [#.None false] + [#.None #0] (#.Some root) (let [root-key (get@ #key root) @@ -480,13 +480,13 @@ (if (T/= root-key key) [(prepend (get@ #left root) (get@ #right root)) - true] + #1] (let [go-left? (T/< root-key key)] (case (recur (if go-left? (get@ #left root) (get@ #right root))) - [#.None false] - [#.None false] + [#.None #0] + [#.None #0] [side-outcome _] (if go-left? @@ -494,20 +494,20 @@ (^multi (#.Some left) [(get@ #color left) #Black]) [(#.Some (balance-left-remove root-key root-val side-outcome (get@ #right root))) - false] + #0] _ [(#.Some (red root-key root-val side-outcome (get@ #right root))) - false]) + #0]) (case (get@ #right root) (^multi (#.Some right) [(get@ #color right) #Black]) [(#.Some (balance-right-remove root-key root-val (get@ #left root) side-outcome)) - false] + #0] _ [(#.Some (red root-key root-val (get@ #left root) side-outcome)) - false]) + #0]) ))) )) ))] @@ -560,7 +560,7 @@ entriesS (entries sample)] (case [entriesR entriesS] [#.Nil #.Nil] - true + #1 [(#.Cons [keyR valueR] entriesR') (#.Cons [keyS valueS] entriesS')] (and (:: Equivalence<k> = keyR keyS) @@ -568,4 +568,4 @@ (recur entriesR' entriesS')) _ - false))))) + #0))))) diff --git a/stdlib/source/lux/data/collection/dictionary/plist.lux b/stdlib/source/lux/data/collection/dictionary/plist.lux index 050185307..1f16dcd77 100644 --- a/stdlib/source/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/lux/data/collection/dictionary/plist.lux @@ -21,10 +21,10 @@ (All [a] (-> Text (PList a) Bit)) (case (get key properties) (#.Some _) - true + #1 #.None - false)) + #0)) (def: #export (put key val properties) (All [a] (-> Text a (PList a) (PList a))) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index c734c140b..111c9b00e 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -171,7 +171,7 @@ (list x))) (def: #export (find p xs) - {#.doc "Returns the first value in the list for which the predicate is true."} + {#.doc "Returns the first value in the list for which the predicate is #1."} (All [a] (-> (-> a Bit) (List a) (Maybe a))) (case xs @@ -248,8 +248,8 @@ output output))))] - [every? true and] - [any? false or] + [every? #1 and] + [any? #0 or] ) (def: #export (nth i xs) @@ -271,14 +271,14 @@ (def: (= xs ys) (case [xs ys] [#.Nil #.Nil] - true + #1 [(#.Cons x xs') (#.Cons y ys')] (and (:: Equivalence<a> = x y) (= xs' ys')) [_ _] - false + #0 ))) (structure: #export Monoid<List> (All [a] @@ -354,13 +354,13 @@ (def: #export (empty? xs) (All [a] (-> (List a) Bit)) (case xs - #.Nil true - _ false)) + #.Nil #1 + _ #0)) (def: #export (member? eq xs x) (All [a] (-> (Equivalence a) (List a) a Bit)) (case xs - #.Nil false + #.Nil #0 (#.Cons x' xs') (or (:: eq = x x') (member? eq xs' x)))) diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index dbf6dec75..11162ae8c 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -45,7 +45,7 @@ (All [a] (-> (Equivalence a) (Queue a) a Bit)) (case queue #.None - false + #0 (#.Some fingers) (loop [node (get@ #finger.node fingers)] diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 197e596e6..7ae37ebea 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -235,10 +235,10 @@ hierarchy (get@ #root vec)] (case [(n/> branching-exponent level) (array.read (branch-idx (i64.logical-right-shift level idx)) hierarchy)] - [true (#.Some (#Hierarchy sub))] + [#1 (#.Some (#Hierarchy sub))] (recur (level-down level) sub) - [false (#.Some (#Base base))] + [#0 (#.Some (#Base base))] (#.Some base) [_ #.None] @@ -357,7 +357,7 @@ (:: (array.Equivalence<Array> (Equivalence<Node> Equivalence<a>)) = h1 h2) _ - false))) + #0))) (structure: #export (Equivalence<Row> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Row a)))) (def: (= v1 v2) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index 0a2350324..9a8258de2 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -112,9 +112,9 @@ (def: #export (partition p xs) {#.doc "Split a sequence in two based on a predicate. - The left side contains all entries for which the predicate is true. + The left side contains all entries for which the predicate is #1. - The right side contains all entries for which the predicate is false."} + The right side contains all entries for which the predicate is #0."} (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) [(filter p xs) (filter (complement p) xs)]) diff --git a/stdlib/source/lux/data/collection/tree/finger.lux b/stdlib/source/lux/data/collection/tree/finger.lux index b77fca2ec..3c449f57a 100644 --- a/stdlib/source/lux/data/collection/tree/finger.lux +++ b/stdlib/source/lux/data/collection/tree/finger.lux @@ -1,6 +1,8 @@ (.module: [lux #* - [control ["m" monoid]] + [control + ["m" monoid] + [predicate (#+ Predicate)]] [data [text format]]]) (type: #export (Node m a) @@ -51,11 +53,11 @@ (recur shifted-tag right))))) #.None))) -(def: #export (found? pred tree) - (All [m a] (-> (-> m Bit) (Tree m a) Bit)) - (case (search pred tree) +(def: #export (found? predicate tree) + (All [m a] (-> (Predicate m) (Tree m a) Bit)) + (case (search predicate tree) (#.Some _) - true + #1 #.None - false)) + #0)) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index cdaba29fc..030ddb36e 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -60,10 +60,10 @@ (All [a] (-> (Zipper a) Bit)) (case (get@ #parent zipper) #.None - true + #1 _ - false)) + #0)) (def: #export (down zipper) (All [a] (-> (Zipper a) (Zipper a))) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index a5dcde900..b0c2a8b65 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -156,8 +156,8 @@ (case (: Nat data) (^template [<nat> <bit>] <nat> (#error.Success [(inc offset) blob] <bit>)) - ([+0 false] - [+1 true]) + ([+0 #0] + [+1 #1]) _ (ex.throw invalid-tag [+2 data])) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 4dfa6cb7d..261ff1330 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -54,7 +54,7 @@ (syntax: #export (json token) {#.doc (doc "A simple way to produce JSON literals." - (json true) + (json #1) (json 123.456) (json "Some text") (json #null) @@ -154,7 +154,7 @@ (def: (= x y) (case [x y] [#Null #Null] - true + #1 (^template [<tag> <struct>] [(<tag> x') (<tag> y')] @@ -167,12 +167,12 @@ (and (n/= (row.size xs) (row.size ys)) (list/fold (function (_ idx prev) (and prev - (maybe.default false + (maybe.default #0 (do maybe.Monad<Maybe> [x' (row.nth idx xs) y' (row.nth idx ys)] (wrap (= x' y')))))) - true + #1 (list.indices (row.size xs)))) [(#Object xs) (#Object ys)] @@ -180,13 +180,13 @@ (list/fold (function (_ [xk xv] prev) (and prev (case (dict.get xk ys) - #.None false + #.None #0 (#.Some yv) (= xv yv)))) - true + #1 (dict.entries xs))) _ - false))) + #0))) ############################################################ ############################################################ @@ -420,13 +420,13 @@ [_ (l.this <token>)] (wrap <value>)))] - [t~ "true" true] - [f~ "false" false] + [true~ "true" #1] + [false~ "false" #0] ) (def: boolean~ (l.Lexer Boolean) - (p.either t~ f~)) + (p.either true~ false~)) (def: number~ (l.Lexer Number) diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index fcdca14c8..6d6e93799 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -242,7 +242,7 @@ (list.every? (product.uncurry =)))) _ - false))) + #0))) (type: #export (Reader a) (p.Parser (List XML) a)) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index 90712968b..bc9d0af95 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -52,13 +52,13 @@ (def: (= mx my) (case [mx my] [#.None #.None] - true + #1 [(#.Some x) (#.Some y)] (:: Equivalence<a> = x y) _ - false))) + #0))) (structure: #export (MaybeT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index cb322299c..7f591c85c 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -615,9 +615,9 @@ (if (f/= -1.0 sign) +1 +0) dot-idx)) decimal-part (maybe.assume ("lux text clip" raw-bin (inc dot-idx) ("lux text size" raw-bin))) - hex-output (|> (<from> false decimal-part) + hex-output (|> (<from> #0 decimal-part) ("lux text concat" ".") - ("lux text concat" (<from> true whole-part)) + ("lux text concat" (<from> #1 whole-part)) ("lux text concat" (if (f/= -1.0 sign) "-" "")))] hex-output)) @@ -672,10 +672,10 @@ (-> Text Bit) (case ("lux text index" number "_" +0) (#.Some +0) - true + #1 _ - false)) + #0)) (def: clean-underscores (-> Text Text) @@ -777,15 +777,15 @@ (def: (digits-to-text digits) (-> Digits Text) (loop [idx (dec i64.width) - all-zeroes? true + all-zeroes? #1 output ""] (if (i/>= 0 (:coerce Int idx)) (let [digit (digits-get idx digits)] (if (and (n/= +0 digit) all-zeroes?) - (recur (dec idx) true output) + (recur (dec idx) #1 output) (recur (dec idx) - false + #0 ("lux text concat" (:: Codec<Text,Int> encode (:coerce Int digit)) output)))) @@ -880,10 +880,10 @@ (let [length ("lux text size" input) dotted? (case ("lux text index" input "." +0) (#.Some +0) - true + #1 _ - false)] + #0)] (if (and dotted? (n/<= (inc i64.width) length)) (case (|> ("lux text clip" input +1 length) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 8120f19d5..a5223c3e3 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -63,10 +63,10 @@ (-> Text Text Bit) (case (index-of prefix x) (#.Some +0) - true + #1 _ - false)) + #0)) (def: #export (ends-with? postfix x) (-> Text Text Bit) @@ -76,16 +76,16 @@ (n/+ (size postfix) n)) _ - false)) + #0)) (def: #export (contains? sub text) (-> Text Text Bit) (case ("lux text index" text sub +0) (#.Some _) - true + #1 _ - false)) + #0)) (def: #export (clip from to input) (-> Nat Nat Text (Maybe Text)) @@ -202,8 +202,8 @@ (def: #export (empty? text) (-> Text Bit) (case text - "" true - _ false)) + "" #1 + _ #0)) (def: #export (enclose [left right] content) {#.doc "Surrounds the given content text with left and right side additions."} @@ -239,7 +239,7 @@ (^or (^ (char "\t")) (^ (char "\v")) (^ (char " ")) (^ (char "\n")) (^ (char "\r")) (^ (char "\f"))) - true + #1 _ - false)) + #0)) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index d9b07db1e..3ece75c23 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -82,10 +82,10 @@ (function (_ (^@ input [offset tape])) (case (text.index-of' reference offset tape) (^multi (#.Some where) (n/= offset where)) - (#e.Success [[(n/+ (text.size reference) offset) tape] true]) + (#e.Success [[(n/+ (text.size reference) offset) tape] #1]) _ - (#e.Success [input false])))) + (#e.Success [input #0])))) (def: #export end {#.doc "Ensure the lexer's input is empty."} diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 107270225..94012c086 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -375,7 +375,7 @@ ($_ p.either (do p.Monad<Parser> [_ (l.this "(?:") - [_ scoped] (re-alternative^ false re-scoped^ current-module) + [_ scoped] (re-alternative^ #0 re-scoped^ current-module) _ (l.this ")")] (wrap [#Non-Capturing scoped])) (do p.Monad<Parser> @@ -385,18 +385,18 @@ [_ (l.this "(?<") captured-name identifier-part^ _ (l.this ">") - [num-captures pattern] (re-alternative^ true re-scoped^ current-module) + [num-captures pattern] (re-alternative^ #1 re-scoped^ current-module) _ (l.this ")")] (wrap [(#Capturing [(#.Some captured-name) num-captures]) pattern])) (do p.Monad<Parser> [_ (l.this "(") - [num-captures pattern] (re-alternative^ true re-scoped^ current-module) + [num-captures pattern] (re-alternative^ #1 re-scoped^ current-module) _ (l.this ")")] (wrap [(#Capturing [#.None num-captures]) pattern])))) (def: (regex^ current-module) (-> Text (l.Lexer Code)) - (:: p.Monad<Parser> map product.right (re-alternative^ true re-scoped^ current-module))) + (:: p.Monad<Parser> map product.right (re-alternative^ #1 re-scoped^ current-module))) ## [Syntax] (syntax: #export (regex {pattern s.text}) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 927f16c7d..118ae5a1f 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -281,11 +281,11 @@ (-> Primitive-Mode (List Type-Paramameter) Bit GenericType Code) Code) (case [name+params mode in-array?] - (^multi [[prim #.Nil] #ManualPrM false] + (^multi [[prim #.Nil] #ManualPrM #0] [(manual-primitive-to-type prim) (#.Some output)]) output - (^multi [[prim #.Nil] #AutoPrM false] + (^multi [[prim #.Nil] #AutoPrM #0] [(auto-primitive-to-type prim) (#.Some output)]) output @@ -313,7 +313,7 @@ class->type') (#GenericArray param) - (let [=param (class->type' mode type-params true param)] + (let [=param (class->type' mode type-params #1 param)] (` (.Array (~ =param)))) (^or (#GenericWildcard #.None) (#GenericWildcard (#.Some [#LowerBound _]))) @@ -325,7 +325,7 @@ (def: (class->type mode type-params class) (-> Primitive-Mode (List Type-Paramameter) GenericType Code) - (class->type' mode type-params false class)) + (class->type' mode type-params #0 class)) (def: (type-param-type$ [name bounds]) (-> Type-Paramameter Code) @@ -1298,7 +1298,7 @@ (#private baz java/lang/Object) ## Methods (#public [] (new [value A]) [] - (exec (:= ::foo true) + (exec (:= ::foo #1) (:= ::bar value) (:= ::baz "") [])) @@ -1315,7 +1315,7 @@ "Fields and methods defined in the class can be used with special syntax." "For example:" "::resolved, for accessing the \"resolved\" field." - "(:= ::resolved true) for modifying it." + "(:= ::resolved #1) for modifying it." "(::new! []) for calling the class's constructor." "(::resolve! container [value]) for calling the \"resolve\" method." )} @@ -1394,10 +1394,10 @@ {#.doc (doc "Test for null object reference." (null? (null)) "=>" - true + #1 (null? "YOLO") "=>" - false)} + #0)} (-> (primitive "java.lang.Object") Bit) ("jvm object null?" obj)) @@ -1486,7 +1486,7 @@ (short-class-name full-name)) params' (list/map (|>> product.left code.local-symbol) params)] (` (def: (~ (code.symbol ["" def-name])) - {#.type? true + {#.type? #1 #..jvm-class (~ (code.text full-name))} Type (All [(~+ params')] @@ -1590,8 +1590,8 @@ (def: (free-type-param? [name bounds]) (-> Type-Paramameter Bit) (case bounds - #.Nil true - _ false)) + #.Nil #1 + _ #0)) (def: (type-param->type-arg [name _]) (-> Type-Paramameter Code) @@ -1624,10 +1624,10 @@ (-> Text Bit) (case class (^or "byte" "short" "int" "float") - true + #1 _ - false)) + #0)) (def: (auto-conv [class var]) (-> [Text Code] (List Code)) diff --git a/stdlib/source/lux/language/compiler/analysis.lux b/stdlib/source/lux/language/compiler/analysis.lux index e9eb3b921..a2686d6bf 100644 --- a/stdlib/source/lux/language/compiler/analysis.lux +++ b/stdlib/source/lux/language/compiler/analysis.lux @@ -183,12 +183,12 @@ _ (#.Some {#lefts lefts - #right? false + #right? #0 #value valueA})) (<tag> (#Sum (#.Right valueA))) (#.Some {#lefts lefts - #right? true + #right? #1 #value valueA}) _ diff --git a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux index b718c382d..c19003df6 100644 --- a/stdlib/source/lux/language/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/language/compiler/analysis/case/coverage.lux @@ -32,12 +32,12 @@ _ {#///.lefts lefts - #///.right? false + #///.right? #0 #///.value valueP}) (#.Right valueP) {#///.lefts lefts - #///.right? true + #///.right? #1 #///.value valueP}))) ## The coverage of a pattern-matching expression summarizes how well @@ -64,10 +64,10 @@ (-> Coverage Bit) (case coverage (#Exhaustive _) - true + #1 _ - false)) + #0)) (def: #export (determine pattern) (-> Pattern (Operation Coverage)) @@ -87,8 +87,8 @@ [#///.Frac] [#///.Text]) - ## Bits are the exception, since there is only "true" and - ## "false", which means it is possible for bit + ## Bits are the exception, since there is only "#1" and + ## "#0", which means it is possible for bit ## pattern-matching to become exhaustive if complementary parts meet. (#///.Simple (#///.Bit value)) (operation/wrap (#Bit value)) @@ -149,7 +149,7 @@ (def: (= reference sample) (case [reference sample] [#Exhaustive #Exhaustive] - true + #1 [(#Bit sideR) (#Bit sideS)] (bit/= sideR sideS) @@ -172,7 +172,7 @@ (list.zip2 flatR flatS)))) _ - false))) + #0))) (open: "C/" Equivalence<Coverage>) @@ -228,15 +228,15 @@ [(#Seq leftA rightA) (#Seq leftSF rightSF)] (case [(C/= leftSF leftA) (C/= rightSF rightA)] ## There is nothing the addition adds to the coverage. - [true true] + [#1 #1] redundant-pattern ## The 2 sequences cannot possibly be merged. - [false false] + [#0 #0] (error/wrap (#Alt so-far addition)) ## Same prefix - [true false] + [#1 #0] (do e.Monad<Error> [rightM (merge rightA rightSF)] (if (exhaustive? rightM) @@ -247,7 +247,7 @@ (wrap (#Seq leftSF rightM)))) ## Same suffix - [false true] + [#0 #1] (do e.Monad<Error> [leftM (merge leftA leftSF)] (wrap (#Seq leftM rightA)))) diff --git a/stdlib/source/lux/language/compiler/analysis/module.lux b/stdlib/source/lux/language/compiler/analysis/module.lux index bdc4abf05..1ac2b4ac4 100644 --- a/stdlib/source/lux/language/compiler/analysis/module.lux +++ b/stdlib/source/lux/language/compiler/analysis/module.lux @@ -108,7 +108,7 @@ (|> state (get@ #.modules) (plist.get module) - (case> (#.Some _) true #.None false) + (case> (#.Some _) #1 #.None #0) [state] #e.Success)))) (def: #export (define name definition) @@ -159,8 +159,8 @@ (case (|> state (get@ #.modules) (plist.get module-name)) (#.Some module) (let [active? (case (get@ #.module-state module) - #.Active true - _ false)] + #.Active #1 + _ #0)] (if active? (#e.Success [(update@ #.modules (plist.put module-name (set@ #.module-state <tag> module)) @@ -180,8 +180,8 @@ (#.Some module) (#e.Success [state (case (get@ #.module-state module) - <tag> true - _ false)]) + <tag> #1 + _ #0)]) #.None ((///.throw unknown-module module-name) state)))))] diff --git a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux index 876448b5b..da4d4461b 100644 --- a/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/language/compiler/extension/analysis/host.jvm.lux @@ -681,7 +681,7 @@ [<object> <primitive>]) (do @ [_ (typeA.infer (#.Primitive to-name (list)))] - (wrap true))) + (wrap #1))) (["boolean" "java.lang.Boolean"] ["byte" "java.lang.Byte"] ["short" "java.lang.Short"] @@ -702,7 +702,7 @@ (if (text/= to-name current-name) (do @ [_ (typeA.infer toT)] - (wrap true)) + (wrap #1)) (do @ [current-class (load-class current-name) _ (////.assert cannot-cast (format "From class/primitive: " current-name "\n" @@ -940,19 +940,19 @@ (Modifier::isStatic [modifiers]) _ - true) + #1) (case method-style #Special (not (or (Modifier::isInterface [(Class::getModifiers [] class)]) (Modifier::isAbstract [modifiers]))) _ - true) + #1) (n/= (list.size arg-classes) (list.size parameters)) (list/fold (function (_ [expectedJC actualJC] prev) (and prev (text/= expectedJC actualJC))) - true + #1 (list.zip2 arg-classes parameters)))))) (def: (check-constructor class arg-classes constructor) @@ -966,7 +966,7 @@ (list/fold (function (_ [expectedJC actualJC] prev) (and prev (text/= expectedJC actualJC))) - true + #1 (list.zip2 arg-classes parameters)))))) (def: idx-to-parameter diff --git a/stdlib/source/lux/language/compiler/meta/cache.lux b/stdlib/source/lux/language/compiler/meta/cache.lux index 4a35d81d4..d382c5860 100644 --- a/stdlib/source/lux/language/compiler/meta/cache.lux +++ b/stdlib/source/lux/language/compiler/meta/cache.lux @@ -78,11 +78,11 @@ (do @ [? (:: System<m> directory? file)] (if ? - (wrap false) + (wrap #0) (do @ [_ (..delete System<m> file)] - (wrap true))))))] - [(list.every? (bit/= true)) + (wrap #1))))))] + [(list.every? (bit/= #1)) (if> [(..delete System<m> document)] [(wrap [])])])))) diff --git a/stdlib/source/lux/language/compiler/synthesis.lux b/stdlib/source/lux/language/compiler/synthesis.lux index 202260fa2..3d6762342 100644 --- a/stdlib/source/lux/language/compiler/synthesis.lux +++ b/stdlib/source/lux/language/compiler/synthesis.lux @@ -26,7 +26,7 @@ State {#scope-arity +0 #resolver fresh-resolver - #direct? false + #direct? #0 #locals +0}) (type: #export Primitive @@ -158,8 +158,8 @@ (All [a] (-> (Operation a) (Operation a))) (extension.temporary (set@ #direct? <value>)))] - [indirectly false] - [directly true] + [indirectly #0] + [directly #1] ) (do-template [<name> <type> <tag>] @@ -177,7 +177,7 @@ (All [a] (-> (Operation a) (Operation a)))) (extension.with-state {#scope-arity arity #resolver resolver - #direct? true + #direct? #1 #locals arity})) (do-template [<name> <tag> <type>] diff --git a/stdlib/source/lux/language/compiler/synthesis/case.lux b/stdlib/source/lux/language/compiler/synthesis/case.lux index 0c23d1f52..045abbde7 100644 --- a/stdlib/source/lux/language/compiler/synthesis/case.lux +++ b/stdlib/source/lux/language/compiler/synthesis/case.lux @@ -152,10 +152,10 @@ headB/bodyS]))))) <if> - (as-is (^or (^ [[(analysis.pattern/bit true) thenA] - (list [(analysis.pattern/bit false) elseA])]) - (^ [[(analysis.pattern/bit false) elseA] - (list [(analysis.pattern/bit true) thenA])])) + (as-is (^or (^ [[(analysis.pattern/bit #1) thenA] + (list [(analysis.pattern/bit #0) elseA])]) + (^ [[(analysis.pattern/bit #0) elseA] + (list [(analysis.pattern/bit #1) thenA])])) (do @ [thenS (synthesize^ thenA) elseS (synthesize^ elseA)] diff --git a/stdlib/source/lux/language/compiler/synthesis/expression.lux b/stdlib/source/lux/language/compiler/synthesis/expression.lux index 0d780d444..f6d68fc05 100644 --- a/stdlib/source/lux/language/compiler/synthesis/expression.lux +++ b/stdlib/source/lux/language/compiler/synthesis/expression.lux @@ -92,7 +92,7 @@ (list/map (|>> //.variable/local)) [(//.variable/local +0)] //.function/apply) - (#//.Reference (#reference.Variable (function.adjust arity false var)))) + (#//.Reference (#reference.Variable (function.adjust arity #0 var)))) (#//.Reference (#reference.Variable var))))) (#reference.Foreign register) diff --git a/stdlib/source/lux/language/compiler/synthesis/function.lux b/stdlib/source/lux/language/compiler/synthesis/function.lux index 67f0dda46..e73621b5c 100644 --- a/stdlib/source/lux/language/compiler/synthesis/function.lux +++ b/stdlib/source/lux/language/compiler/synthesis/function.lux @@ -95,10 +95,10 @@ (list/map (.function (_ closure) (case (dict.get closure resolver) (#.Some resolved) - (adjust arity true resolved) + (adjust arity #1 resolved) #.None - (adjust arity false closure))) + (adjust arity #0 closure))) environment) environment) down-environment (: (List Variable) diff --git a/stdlib/source/lux/language/compiler/synthesis/loop.lux b/stdlib/source/lux/language/compiler/synthesis/loop.lux index eeb1adcc7..95666656b 100644 --- a/stdlib/source/lux/language/compiler/synthesis/loop.lux +++ b/stdlib/source/lux/language/compiler/synthesis/loop.lux @@ -21,8 +21,8 @@ (def: (some? maybe) (All [a] (-> (Maybe a) Bit)) (case maybe - (#.Some _) true - #.None false)) + (#.Some _) #1 + #.None #0)) (template: #export (self) (#//.Reference (reference.local +0))) @@ -30,8 +30,8 @@ (template: (recursive-apply args) (#//.Apply (self) args)) -(def: proper Bit true) -(def: improper Bit false) +(def: proper Bit #1) +(def: improper Bit #0) (def: (proper? exprS) (-> Synthesis Bit) diff --git a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux index a84677144..8e0d0c270 100644 --- a/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/language/compiler/translation/scheme/runtime.jvm.lux @@ -51,19 +51,19 @@ (def: #export none Computation - (variant [+0 false ..unit])) + (variant [+0 #0 ..unit])) (def: #export some (-> Expression Computation) - (|>> [+0 true] ..variant)) + (|>> [+0 #1] ..variant)) (def: #export left (-> Expression Computation) - (|>> [+0 false] ..variant)) + (|>> [+0 #0] ..variant)) (def: #export right (-> Expression Computation) - (|>> [+0 true] ..variant)) + (|>> [+0 #1] ..variant)) (def: declaration (s.Syntax [Text (List Text)]) @@ -283,8 +283,8 @@ (_.if (_.eq?/2 old @temp) (_.begin (list (_.vector-set!/3 atom (_.int 0) new) - (_.bool true))) - (_.bool false))))) + (_.bool #1))) + (_.bool #0))))) (def: runtime//atom Computation diff --git a/stdlib/source/lux/language/host/scheme.lux b/stdlib/source/lux/language/host/scheme.lux index d2edd6fac..e312e769b 100644 --- a/stdlib/source/lux/language/host/scheme.lux +++ b/stdlib/source/lux/language/host/scheme.lux @@ -63,8 +63,8 @@ (def: #export bool (-> Bit Computation) - (|>> (case> true "#t" - false "#f") + (|>> (case> #0 "#f" + #1 "#t") :abstraction)) (def: #export int diff --git a/stdlib/source/lux/language/reference.lux b/stdlib/source/lux/language/reference.lux index 0f4ee03a5..84b838b3d 100644 --- a/stdlib/source/lux/language/reference.lux +++ b/stdlib/source/lux/language/reference.lux @@ -24,7 +24,7 @@ ([#Local] [#Foreign]) _ - false))) + #0))) (structure: #export _ (Hash Variable) (def: eq Equivalence<Variable>) @@ -61,7 +61,7 @@ (-> Variable Bit) (|>> ..variable (case> (^ (..local +0)) - true + #1 _ - false))) + #0))) diff --git a/stdlib/source/lux/language/syntax.lux b/stdlib/source/lux/language/syntax.lux index e31356dcb..18fd61c8a 100644 --- a/stdlib/source/lux/language/syntax.lux +++ b/stdlib/source/lux/language/syntax.lux @@ -354,7 +354,7 @@ (loop [text-read "" where (|> where (update@ #.column inc)) - must-have-offset? false] + must-have-offset? #0] (p.either (if must-have-offset? ## If I'm at the start of a ## new line, I must ensure the @@ -376,7 +376,7 @@ (format text-read)) (|> where (update@ #.column (n/+ offset-size))) - false) + #0) (p.fail (format "Each line of a multi-line text must have an appropriate offset!\n" "Expected: " (%i (.int offset-column)) " columns.\n" " Actual: " (%i (.int offset-size)) " columns.\n")))) @@ -387,7 +387,7 @@ (recur (format text-read normal) (|> where (update@ #.column (n/+ (text.size normal)))) - false)) + #0)) ## Must handle escaped ## chars separately. (do @ @@ -395,7 +395,7 @@ (recur (format text-read char) (|> where (update@ #.column (n/+ chars-consumed))) - false)) + #0)) ## The text ends when it ## reaches the right-delimiter. (do @ @@ -413,7 +413,7 @@ (|> where (update@ #.line inc) (set@ #.column +0)) - true)))))] + #1)))))] (wrap [where' [where (#.Text text-read)]]))) @@ -581,8 +581,8 @@ (^template [<name> <value>] ["" <name>] (#.Bit <value>)) - (["true" true] - ["false" false]) + (["#0" #0] + ["#1" #1]) _ (#.Symbol value))]]))) diff --git a/stdlib/source/lux/language/type.lux b/stdlib/source/lux/language/type.lux index cdb43422d..11b1e1223 100644 --- a/stdlib/source/lux/language/type.lux +++ b/stdlib/source/lux/language/type.lux @@ -55,7 +55,7 @@ (and (text/= xname yname) (n/= (list.size yparams) (list.size xparams)) (list/fold (.function (_ [x y] prev) (and prev (= x y))) - true + #1 (list.zip2 xparams yparams))) (^template [<tag>] @@ -82,11 +82,11 @@ (and (n/= (list.size yenv) (list.size xenv)) (= xbody ybody) (list/fold (.function (_ [x y] prev) (and prev (= x y))) - true + #1 (list.zip2 xenv yenv))) _ - false + #0 ))) ## [Values] @@ -319,16 +319,16 @@ (quantified? _type) (#.Apply A F) - (maybe.default false + (maybe.default #0 (do maybe.Monad<Maybe> [applied (apply (list A) F)] (wrap (quantified? applied)))) (^or (#.UnivQ _) (#.ExQ _)) - true + #1 _ - false)) + #0)) (def: #export (array level elem-type) (-> Nat Type Type) diff --git a/stdlib/source/lux/language/type/check.lux b/stdlib/source/lux/language/type/check.lux index 3308c497b..abd6bda5e 100644 --- a/stdlib/source/lux/language/type/check.lux +++ b/stdlib/source/lux/language/type/check.lux @@ -186,7 +186,7 @@ #.None (ex.throw unknown-type-var id))))] - [bound? Bit false true] + [bound? Bit #0 #1] [read (Maybe Type) #.None (#.Some bound)] ) @@ -348,7 +348,7 @@ (-> [Type Type] Bit (List Assumption) (List Assumption)) (#.Cons [ea status] assumptions)) -(def: (on id type then else) +(def: (if-bind id type then else) (All [a] (-> Var Type (Check a) (-> Type (Check a)) (Check a))) @@ -530,16 +530,16 @@ (check-vars check' assumptions idE idA) [(#.Var id) _] - (on id actual - (check/wrap assumptions) - (function (_ bound) - (check' bound actual assumptions))) + (if-bind id actual + (check/wrap assumptions) + (function (_ bound) + (check' bound actual assumptions))) [_ (#.Var id)] - (on id expected - (check/wrap assumptions) - (function (_ bound) - (check' expected bound assumptions))) + (if-bind id expected + (check/wrap assumptions) + (function (_ bound) + (check' expected bound assumptions))) (^template [<fe> <fa>] [(#.Apply A1 <fe>) (#.Apply A2 <fa>)] @@ -560,7 +560,7 @@ #.None (do Monad<Check> [expected' (apply-type! F A)] - (check' expected' actual (assume! fx-pair true assumptions))))) + (check' expected' actual (assume! fx-pair #1 assumptions))))) [_ (#.Apply A F)] (do Monad<Check> @@ -636,10 +636,10 @@ (-> Type Type Bit) (case (run fresh-context (check expected actual)) (#e.Error error) - false + #0 (#e.Success _) - true)) + #1)) (def: #export context (Check Type-Context) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index d063f1ab2..fea0fa783 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -97,7 +97,7 @@ (#e.Success [compiler' output])))) (def: #export (assert message test) - {#.doc "Fails with the given message if the test is false."} + {#.doc "Fails with the given message if the test is #0."} (-> Text Bit (Meta Any)) (function (_ compiler) (if test @@ -188,9 +188,9 @@ (get-text-ann (ident-for #.doc) anns)) (def: #export (flag-set? flag-name anns) - {#.doc "Finds out whether an annotation-as-a-flag is set (has value 'true')."} + {#.doc "Finds out whether an annotation-as-a-flag is set (has value '#1')."} (-> Ident Code Bit) - (maybe.default false (get-bit-ann flag-name anns))) + (maybe.default #0 (get-bit-ann flag-name anns))) (do-template [<name> <tag> <desc>] [(def: #export <name> @@ -210,10 +210,10 @@ (-> Code Bit) (case (get-symbol-ann (ident-for #.alias) annotations) (#.Some _) - true + #1 #.None - false)) + #0)) (do-template [<name> <tag> <type>] [(def: (<name> input) @@ -421,10 +421,10 @@ (function (_ compiler) (#e.Success [compiler (case (get module (get@ #.modules compiler)) (#.Some _) - true + #1 #.None - false)]))) + #0)]))) (def: (try-both f x1 x2) (All [a b] @@ -701,10 +701,10 @@ (case tokens (^ (list [_ (#.Tag ["" "omit"])] token)) - (#.Some [true token]) + (#.Some [#1 token]) (^ (list token)) - (#.Some [false token]) + (#.Some [#0 token]) _ #.None)) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 67be6ce56..a599bbae8 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -84,7 +84,7 @@ = xs' ys') _ - false))) + #0))) ## [Values] (def: #export (to-text ast) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 7c86a952a..cd37a8f4b 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -388,7 +388,7 @@ (` ((~ (code.symbol poly-func)) (~+ (list/map code.symbol poly-args)))))]] (wrap (.list (` (def: (~+ (csw.export export)) (~ (code.symbol ["" name])) - {#.struct? true} + {#.struct? #1} (~ impl))))))) ## [Derivers] diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 66bc621ca..c651a5b59 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -49,7 +49,7 @@ (wrap (` (: (~ (@Equivalence inputT)) <eq>))))] - [(poly.exactly Any) (function ((~ g!_) (~ g!_) (~ g!_)) true)] + [(poly.exactly Any) (function ((~ g!_) (~ g!_) (~ g!_)) #1)] [(poly.similar Bit) bit.Equivalence<Bit>] [(poly.similar Nat) number.Equivalence<Nat>] [(poly.similar Int) number.Equivalence<Int>] @@ -111,7 +111,7 @@ (` ((~ g!eq) (~ g!left) (~ g!right))))) (list.enumerate members)))) (~ g!_) - false)))))) + #0)))))) ## Tuples (do @ [g!eqs (poly.tuple (p.many Equivalence<?>)) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 630dd5a0e..a22e8a121 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -77,7 +77,7 @@ (#error.Success [remaining is-it?])) _ - (#error.Success [tokens false])))) + (#error.Success [tokens #0])))) (def: #export (this ast) {#.doc "Ensures the given Code is the next input."} @@ -155,14 +155,13 @@ (Syntax Bit) (function (_ tokens) (case tokens - #.Nil (#error.Success [tokens true]) - _ (#error.Success [tokens false])))) + #.Nil (#error.Success [tokens #1]) + _ (#error.Success [tokens #0])))) -(def: #export (on compiler action) - {#.doc "Run a Lux operation as if it was a Syntax parser."} - (All [a] (-> Lux (Meta a) (Syntax a))) +(def: #export (lift outcome) + (All [a] (-> (Error a) (Syntax a))) (function (_ input) - (case (macro.run compiler action) + (case outcome (#error.Error error) (#error.Error error) @@ -215,10 +214,10 @@ (let [[exported? tokens] (: [Bit (List Code)] (case tokens (^ (list& [_ (#.Tag ["" "export"])] tokens')) - [true tokens'] + [#1 tokens'] _ - [false tokens])) + [#0 tokens])) ?parts (: (Maybe [Text (List Code) Code Code]) (case tokens (^ (list [_ (#.Form (list& [_ (#.Symbol ["" name])] args))] diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 408edae91..a3dafa296 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -15,8 +15,8 @@ ## Exports (def: #export export (Syntax Bit) - (p.either (p.after (s.this (' #export)) (parser/wrap true)) - (parser/wrap false))) + (p.either (p.after (s.this (' #export)) (parser/wrap #1)) + (parser/wrap #0))) ## Declarations (def: #export declaration @@ -106,8 +106,10 @@ (-> Lux (Syntax //.Definition)) (do p.Monad<Parser> [definition-raw s.any - me-definition-raw (s.on compiler - (macro.expand-all definition-raw))] + me-definition-raw (|> definition-raw + macro.expand-all + (macro.run compiler) + s.lift)] (s.local me-definition-raw (s.form (do @ [_ (s.this (' "lux def")) diff --git a/stdlib/source/lux/math/logic/continuous.lux b/stdlib/source/lux/math/logic/continuous.lux index 972bfac0e..a6fe71bb6 100644 --- a/stdlib/source/lux/math/logic/continuous.lux +++ b/stdlib/source/lux/math/logic/continuous.lux @@ -1,39 +1,39 @@ (.module: - [lux #* + [lux (#- false true or and not) [data [number ("rev/" Interval<Rev>)]]]) -(def: #export ~true Rev rev/top) -(def: #export ~false Rev rev/bottom) +(def: #export true Rev rev/top) +(def: #export false Rev rev/bottom) (do-template [<name> <chooser>] [(def: #export <name> (-> Rev Rev Rev) <chooser>)] - [~and r/min] - [~or r/max] + [and r/min] + [or r/max] ) -(def: #export (~not input) +(def: #export (not input) (-> Rev Rev) - (r/- input ~true)) + (r/- input ..true)) -(def: #export (~implies consequent antecedent) +(def: #export (implies consequent antecedent) (-> Rev Rev Rev) - (~or (~not antecedent) - consequent)) + (or (not antecedent) + consequent)) -(def: #export (includes~ sub super) +(def: #export (includes sub super) (-> Rev Rev Rev) - (let [-sub (~not sub) + (let [-sub (not sub) sum (r/+ -sub super) - no-overflow? (and (r/>= -sub sum) - (r/>= super sum))] + no-overflow? (.and (r/>= -sub sum) + (r/>= super sum))] (if no-overflow? sum - ~true))) + ..true))) -(def: #export (~= left right) +(def: #export (= left right) (-> Rev Rev Rev) - (~and (~or (~not left) right) - (~or left (~not right)))) + (and (or (not left) right) + (or left (not right)))) diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux index 4bb58ae1a..0ee8a0c36 100644 --- a/stdlib/source/lux/math/logic/fuzzy.lux +++ b/stdlib/source/lux/math/logic/fuzzy.lux @@ -18,32 +18,32 @@ (def: #export (union left right) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) - (&.~or (membership elem left) - (membership elem right)))) + (&.or (membership elem left) + (membership elem right)))) (def: #export (intersection left right) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) - (&.~and (membership elem left) - (membership elem right)))) + (&.and (membership elem left) + (membership elem right)))) (def: #export (complement set) (All [a] (-> (Fuzzy a) (Fuzzy a))) (function (_ elem) - (&.~not (membership elem set)))) + (&.not (membership elem set)))) (def: #export (difference sub base) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (function (_ elem) - (&.~and (membership elem base) - (&.~not (membership elem sub))))) + (&.and (membership elem base) + (&.not (membership elem sub))))) (def: #export (from-predicate predicate) (All [a] (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) - &.~true - &.~false))) + &.true + &.false))) (def: #export (from-set set) (All [a] (-> (Set a) (Fuzzy a))) @@ -53,10 +53,10 @@ (-> Rev Rev (Fuzzy Rev)) (function (_ elem) (cond (r/<= from elem) - &.~false + &.false (r/>= to elem) - &.~true + &.true ## in the middle... (r// (r/- from to) @@ -66,10 +66,10 @@ (-> Rev Rev (Fuzzy Rev)) (function (_ elem) (cond (r/<= from elem) - &.~true + &.true (r/>= to elem) - &.~false + &.false ## in the middle... (r// (r/- from to) @@ -106,8 +106,8 @@ (function (_ elem) (let [membership (set elem)] (if (r/> treshold membership) - (|> membership (r/- treshold) (r/* &.~true)) - &.~false)))) + (|> membership (r/- treshold) (r/* &.true)) + &.false)))) (def: #export (to-predicate treshold set) (All [a] (-> Rev (Fuzzy a) (Predicate a))) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index d4fb7108f..f9bd93926 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -48,7 +48,7 @@ (:: r.Monad<Random> wrap))) (def: #export (assert message condition) - {#.doc "Check that a condition is true, and fail with the given message otherwise."} + {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit (Promise [Counters Text])) (<| (:: promise.Monad<Promise> wrap) (if condition @@ -56,7 +56,7 @@ [failure (format " [Error] " message)]))) (def: #export (test message condition) - {#.doc "Check that a condition is true, and fail with the given message otherwise."} + {#.doc "Check that a condition is #1, and fail with the given message otherwise."} (-> Text Bit Test) (:: r.Monad<Random> wrap (assert message condition))) @@ -133,17 +133,17 @@ (test "Can create lists easily through macros." (and (case (list 1 2 3) (#.Cons 1 (#.Cons 2 (#.Cons 3 #.Nil))) - true + #1 _ - false) + #0) (case (list& 1 2 3 (list 4 5 6)) (#.Cons 1 (#.Cons 2 (#.Cons 3 (#.Cons 4 (#.Cons 5 (#.Cons 6 #.Nil)))))) - true + #1 _ - false))) + #0))) (test "Can have defaults for Maybe values." (and (is? "yolo" (maybe.default "yolo" @@ -204,10 +204,10 @@ (list/map (function (_ [def-name [_ def-anns _]]) (case (macro.get-text-ann (ident-for #..test) def-anns) (#.Some description) - [true module-name def-name description] + [#1 module-name def-name description] _ - [false module-name def-name ""]))) + [#0 module-name def-name ""]))) (list.filter product.left) (list/map product.right))))) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index e80db8bac..3851d5ab4 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -36,7 +36,7 @@ (case [reference sample] (^template [<tag>] [<tag> <tag>] - true) + #1) ([#January] [#February] [#March] @@ -51,7 +51,7 @@ [#December]) _ - false))) + #0))) (def: (month-to-nat month) (-> Month Nat) @@ -126,7 +126,7 @@ (case [reference sample] (^template [<tag>] [<tag> <tag>] - true) + #1) ([#Sunday] [#Monday] [#Tuesday] @@ -136,7 +136,7 @@ [#Saturday]) _ - false))) + #0))) (def: (day-to-nat day) (-> Day Nat) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index b9300b7c3..748cd039e 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -12,7 +12,8 @@ [text ("text/" Monoid<Text>) ["l" lexer]] ["e" error]] - [type abstract]]) + [type + abstract]]) (abstract: #export Duration {#.doc "Durations have a resolution of milliseconds."} diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 53ae64051..7b8effc5d 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -55,7 +55,7 @@ (def: down-cast Text ":abstraction") (def: up-cast Text ":representation") -(def: macro-anns Code (' {#.macro? true})) +(def: macro-anns Code (' {#.macro? #1})) (def: representation-name (-> Text Text) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index b2c747028..103f79d27 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -287,10 +287,10 @@ (-> Code Bit) (case input [_ (#.Symbol _)] - true + #1 _ - false)) + #0)) (def: (join-pair [l r]) (All [a] (-> [a a] (List a))) diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 6630f8a60..9758d7e44 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -153,8 +153,8 @@ _ (OutputStream::flush [] stream)] (AutoCloseable::close [] stream)))] - [append true] - [write false] + [append #1] + [write #0] ) (def: (read file) @@ -209,7 +209,7 @@ (do io.Monad<IO> [outcome (<method> [] (java/io/File::new subject))] (case outcome - (#error.Success true) + (#error.Success #1) (wrap (#error.Success [])) _ @@ -225,7 +225,7 @@ [outcome (<method> [(|> parameter <parameter-pre>)] (java/io/File::new subject))] (case outcome - (#error.Success true) + (#error.Success #1) (wrap (#error.Success [])) _ @@ -244,5 +244,5 @@ (|> file (do> (:: System<m> &monad) [(:: System<m> file?)] - [(if> [(wrap true)] + [(if> [(wrap #1)] [(:: System<m> directory? file)])]))) diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index 4f1a810c2..a4730e2ef 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -165,17 +165,17 @@ (test "Can create lists easily through macros." (and (case (list 1 2 3) (#.Cons 1 (#.Cons 2 (#.Cons 3 #.Nil))) - true + #1 _ - false) + #0) (case (list& 1 2 3 (list 4 5 6)) (#.Cons 1 (#.Cons 2 (#.Cons 3 (#.Cons 4 (#.Cons 5 (#.Cons 6 #.Nil)))))) - true + #1 _ - false))) + #0))) (test "Can have defaults for Maybe values." (and (is? "yolo" (maybe.default "yolo" @@ -200,9 +200,9 @@ (context: "Cross-platform support." ($_ seq (test "Can provide default in case there is no particular platform support." - (for {"" false} - true)) + (for {"" #0} + #1)) (test "Can pick code depending on the platform being targeted." - (for {"JVM" true - "JS" true} - false)))) + (for {"JVM" #1 + "JS" #1} + #0)))) diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index 208b5b1b2..0bcdb785e 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -32,31 +32,31 @@ (test "Can read any argument." (|> (/.run (list yes) /.any) (case> (#E.Error _) - false + #0 (#E.Success arg) (text/= arg yes)))) (test "Can test tokens." (and (|> (/.run (list yes) (/.this yes)) - (case> (#E.Error _) false (#E.Success _) true)) + (case> (#E.Error _) #0 (#E.Success _) #1)) (|> (/.run (list no) (/.this yes)) - (case> (#E.Error _) true (#E.Success _) false)))) + (case> (#E.Error _) #1 (#E.Success _) #0)))) (test "Can use custom token parsers." (|> (/.run (list yes) (/.parse Nat/decode)) (case> (#E.Error _) - false + #0 (#E.Success parsed) (text/= (Nat/encode parsed) yes)))) (test "Can query if there are any more inputs." (and (|> (/.run (list) /.end) - (case> (#E.Success []) true _ false)) + (case> (#E.Success []) #1 _ #0)) (|> (/.run (list yes) (p.not /.end)) - (case> (#E.Success []) false _ true)))) + (case> (#E.Success []) #0 _ #1)))) (test "Can parse CLI input anywhere." (|> (/.run (list.concat (list pre-ignore (list yes) post-ignore)) (|> (/.somewhere (/.this yes)) (p.before (p.some /.any)))) - (case> (#E.Error _) false (#E.Success _) true))) + (case> (#E.Error _) #0 (#E.Success _) #1))) )))) diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index 1bb6b5b0b..a4f2ae234 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -72,5 +72,5 @@ outcome (#e.Error error) - false)))) + #0)))) )) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 29bab782c..0aae405ab 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -17,60 +17,60 @@ (context: "Promises" ($_ seq (wrap (do &.Monad<Promise> - [running? (&.future (io true))] + [running? (&.future (io #1))] (assert "Can run IO actions in separate threads." running?))) (wrap (do &.Monad<Promise> [_ (&.wait +500)] (assert "Can wait for a specified amount of time." - true))) + #1))) (wrap (do &.Monad<Promise> - [[left right] (&.seq (&.future (io true)) - (&.future (io false)))] + [[left right] (&.seq (&.future (io #1)) + (&.future (io #0)))] (assert "Can combine promises sequentially." (and left (not right))))) (wrap (do &.Monad<Promise> - [?left (&.alt (&.delay +100 true) - (&.delay +200 false)) - ?right (&.alt (&.delay +200 true) - (&.delay +100 false))] + [?left (&.alt (&.delay +100 #1) + (&.delay +200 #0)) + ?right (&.alt (&.delay +200 #1) + (&.delay +100 #0))] (assert "Can combine promises alternatively." (case [?left ?right] - [(#.Left true) (#.Right false)] - true + [(#.Left #1) (#.Right #0)] + #1 _ - false)))) + #0)))) (wrap (do &.Monad<Promise> - [?left (&.either (&.delay +100 true) - (&.delay +200 false)) - ?right (&.either (&.delay +200 true) - (&.delay +100 false))] + [?left (&.either (&.delay +100 #1) + (&.delay +200 #0)) + ?right (&.either (&.delay +200 #1) + (&.delay +100 #0))] (assert "Can combine promises alternatively [Part 2]." (and ?left (not ?right))))) (test "Can poll a promise for its value." - (and (|> (&.poll (&/wrap true)) - (case> (#.Some true) true _ false)) - (|> (&.poll (&.delay +200 true)) - (case> #.None true _ false)))) + (and (|> (&.poll (&/wrap #1)) + (case> (#.Some #1) #1 _ #0)) + (|> (&.poll (&.delay +200 #1)) + (case> #.None #1 _ #0)))) (test "Cannot re-resolve a resolved promise." - (and (not (io.run (&.resolve false (&/wrap true)))) - (io.run (&.resolve true (: (&.Promise Bit) (&.promise #.None)))))) + (and (not (io.run (&.resolve #0 (&/wrap #1)))) + (io.run (&.resolve #1 (: (&.Promise Bit) (&.promise #.None)))))) (wrap (do &.Monad<Promise> - [?none (&.time-out +100 (&.delay +200 true)) - ?some (&.time-out +200 (&.delay +100 true))] + [?none (&.time-out +100 (&.delay +200 #1)) + ?some (&.time-out +200 (&.delay +100 #1))] (assert "Can establish maximum waiting times for promises to be fulfilled." (case [?none ?some] - [#.None (#.Some true)] - true + [#.None (#.Some #1)] + #1 _ - false)))) + #0)))) )) diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index 8a5c1cbce..7eadd5ac7 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -34,7 +34,7 @@ (wrap (do promise.Monad<Promise> [_ (wait-many-times open-positions semaphore)] (assert "Can wait on a semaphore up to the number of open positions without blocking." - true)))) + #1)))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> [result (<| (promise.time-out +100) @@ -42,10 +42,10 @@ (assert "Waiting on a semaphore more than the number of open positions blocks the process." (case result (#.Some _) - false + #0 #.None - true))))) + #1))))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> [_ (: (Promise Any) @@ -57,7 +57,7 @@ (recur (dec steps))) (wrap []))))] (assert "Signaling a semaphore replenishes its open positions." - true)))) + #1)))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> [#let [resource (atom.atom "") diff --git a/stdlib/test/test/lux/control/equivalence.lux b/stdlib/test/test/lux/control/equivalence.lux index 5206e892d..7c45e90e0 100644 --- a/stdlib/test/test/lux/control/equivalence.lux +++ b/stdlib/test/test/lux/control/equivalence.lux @@ -18,4 +18,4 @@ (test "Equivalence is symmetric." (if (:: Equivalence<a> = sample another) (:: Equivalence<a> = another sample) - true))))) + #1))))) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 6028eed1a..70cf4cfbe 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -18,52 +18,52 @@ (def: (should-fail input) (All [a] (-> (Error a) Bit)) (case input - (#error.Error _) true - _ false)) + (#error.Error _) #1 + _ #0)) (def: (enforced? parser input) (All [s] (-> (&.Parser s Any) s Bit)) (case (&.run input parser) (#error.Success [_ []]) - true + #1 _ - false)) + #0)) (def: (found? parser input) (All [s] (-> (&.Parser s Bit) s Bit)) (case (&.run input parser) - (#error.Success [_ true]) - true + (#error.Success [_ #1]) + #1 _ - false)) + #0)) (def: (fails? input) (All [a] (-> (Error a) Bit)) (case input (#error.Error _) - true + #1 _ - false)) + #0)) (syntax: (match pattern input) (wrap (list (` (case (~ input) (^ (#error.Success [(~' _) (~ pattern)])) - true + #1 (~' _) - false))))) + #0))))) ## [Tests] (context: "Assertions" (test "Can make assertions while parsing." (and (match [] - (&.run (list (code.bit true) (code.int 123)) - (&.assert "yolo" true))) - (fails? (&.run (list (code.bit true) (code.int 123)) - (&.assert "yolo" false)))))) + (&.run (list (code.bit #1) (code.int 123)) + (&.assert "yolo" #1))) + (fails? (&.run (list (code.bit #1) (code.int 123)) + (&.assert "yolo" #0)))))) (context: "Combinators [Part 1]" ($_ seq @@ -105,14 +105,14 @@ (match -123 (&.run (list (code.int -123) (code.int 456) (code.int 789)) (&.either positive s.int))) - (fails? (&.run (list (code.bit true) (code.int 456) (code.int 789)) + (fails? (&.run (list (code.bit #1) (code.int 456) (code.int 789)) (&.either positive s.int)))))) (test "Can create the opposite/negation of any parser." (and (fails? (&.run (list (code.int 123) (code.int 456) (code.int 789)) (&.not s.int))) (match [] - (&.run (list (code.bit true) (code.int 456) (code.int 789)) + (&.run (list (code.bit #1) (code.int 456) (code.int 789)) (&.not s.int))))) )) diff --git a/stdlib/test/test/lux/control/reader.lux b/stdlib/test/test/lux/control/reader.lux index bc7905f37..560e6565c 100644 --- a/stdlib/test/test/lux/control/reader.lux +++ b/stdlib/test/test/lux/control/reader.lux @@ -32,6 +32,6 @@ (wrap (i/+ a b)))) (&.run "") io.run - (case> 579 true - _ false))) + (case> 579 #1 + _ #0))) )) diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux index 544b42982..266fd2733 100644 --- a/stdlib/test/test/lux/control/region.lux +++ b/stdlib/test/test/lux/control/region.lux @@ -23,8 +23,8 @@ (#e.Success _) <success> (#e.Error _) <error>))] - [success? true false] - [error? false true] + [success? #1 #0] + [error? #0 #1] ) (context: "Regions." diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux index c39be3197..3d8c2fd10 100644 --- a/stdlib/test/test/lux/control/state.lux +++ b/stdlib/test/test/lux/control/state.lux @@ -102,7 +102,7 @@ [state &.get] (wrap (n/< limit state)))]] ($_ seq - (test "'while' will only execute if the condition is true." + (test "'while' will only execute if the condition is #1." (|> (&.while condition (&.update inc)) (&.run +0) (case> [state' output'] diff --git a/stdlib/test/test/lux/control/writer.lux b/stdlib/test/test/lux/control/writer.lux index 6cf50d2bd..8f44f6784 100644 --- a/stdlib/test/test/lux/control/writer.lux +++ b/stdlib/test/test/lux/control/writer.lux @@ -41,6 +41,6 @@ [a (lift (io/wrap 123)) b (wrap 456)] (wrap (i/+ a b)))) - (case> ["" 579] true - _ false))) + (case> ["" 579] #1 + _ #0))) )) diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index f9ab9551f..8d0a93a83 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -34,5 +34,5 @@ (:: Equivalence<Bit> = value dec-value) (#.Left _) - false) + #0) ))))) diff --git a/stdlib/test/test/lux/data/collection/array.lux b/stdlib/test/test/lux/data/collection/array.lux index f0f72a14d..91b67b5c5 100644 --- a/stdlib/test/test/lux/data/collection/array.lux +++ b/stdlib/test/test/lux/data/collection/array.lux @@ -64,12 +64,12 @@ ($_ seq (test "Shouldn't be able to find a value in an unoccupied cell." (case (@.read idx (@.delete idx array)) - (#.Some _) false - #.None true)) + (#.Some _) #0 + #.None #1)) (test "You should be able to access values put into the array." (case (@.read idx (@.write idx value array)) (#.Some value') (n/= value' value) - #.None false)) + #.None #0)) (test "All cells should be occupied on a full array." (and (n/= size (@.occupied array)) (n/= +0 (@.vacant array)))) @@ -90,15 +90,15 @@ ($_ seq (test "Can find values inside arrays." (|> (@.find n/even? array) - (case> (#.Some _) true - #.None false))) + (case> (#.Some _) #1 + #.None #0))) (test "Can find values inside arrays (with access to indices)." (|> (@.find+ (function (_ idx n) (and (n/even? n) (n/< size idx))) array) - (case> (#.Some _) true - #.None false))))))) + (case> (#.Some _) #1 + #.None #0))))))) (context: "Functor" (<| (times +100) diff --git a/stdlib/test/test/lux/data/collection/dictionary.lux b/stdlib/test/test/lux/data/collection/dictionary.lux index b0ad15d7b..f79327c29 100644 --- a/stdlib/test/test/lux/data/collection/dictionary.lux +++ b/stdlib/test/test/lux/data/collection/dictionary.lux @@ -44,31 +44,31 @@ (test "Should be able to get every key." (list.every? (function (_ key) (case (&.get key dict) - (#.Some _) true - _ false)) + (#.Some _) #1 + _ #0)) (&.keys dict))) (test "Shouldn't be able to access non-existant keys." (case (&.get non-key dict) - (#.Some _) false - _ true)) + (#.Some _) #0 + _ #1)) (test "Should be able to put and then get a value." (case (&.get non-key (&.put non-key test-val dict)) (#.Some v) (n/= test-val v) - _ true)) + _ #1)) (test "Should be able to put~ and then get a value." (case (&.get non-key (&.put~ non-key test-val dict)) (#.Some v) (n/= test-val v) - _ true)) + _ #1)) (test "Shouldn't be able to put~ an existing key." (or (n/= +0 size) (let [first-key (|> dict &.keys list.head maybe.assume)] (case (&.get first-key (&.put~ first-key test-val dict)) (#.Some v) (not (n/= test-val v)) - _ true)))) + _ #1)))) (test "Removing a key should make it's value inaccessible." (let [base (&.put non-key test-val dict)] @@ -83,7 +83,7 @@ (n/= (inc x) y) _ - false))) + #0))) (test "Additions and removals to a Dictionary should affect its size." (let [plus (&.put non-key test-val dict) diff --git a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux index 4626886e9..64a51b413 100644 --- a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux @@ -39,24 +39,24 @@ (test "Can query value for minimum key." (case [(&.min sample) (list.head sorted-values)] [#.None #.None] - true + #1 [(#.Some reference) (#.Some sample)] (n/= reference sample) _ - false)) + #0)) (test "Can query value for maximum key." (case [(&.max sample) (list.last sorted-values)] [#.None #.None] - true + #1 [(#.Some reference) (#.Some sample)] (n/= reference sample) _ - false)) + #0)) (test "Converting dictionaries to/from lists cannot change their values." (|> sample @@ -87,6 +87,6 @@ (n/= extra-value found) _ - false))) + #0))) )) )))) diff --git a/stdlib/test/test/lux/data/collection/list.lux b/stdlib/test/test/lux/data/collection/list.lux index 0945a9abb..f5565c455 100644 --- a/stdlib/test/test/lux/data/collection/list.lux +++ b/stdlib/test/test/lux/data/collection/list.lux @@ -234,5 +234,5 @@ [a (lift (io/wrap 123)) b (wrap 456)] (wrap (i/+ a b)))) - (case> (^ (list 579)) true - _ false))))) + (case> (^ (list 579)) #1 + _ #0))))) diff --git a/stdlib/test/test/lux/data/collection/queue.lux b/stdlib/test/test/lux/data/collection/queue.lux index ebb730d58..89f674462 100644 --- a/stdlib/test/test/lux/data/collection/queue.lux +++ b/stdlib/test/test/lux/data/collection/queue.lux @@ -39,7 +39,7 @@ (test "I can always peek at a non-empty queue." (case (&.peek sample) #.None (&.empty? sample) - (#.Some _) true)) + (#.Some _) #1)) (test "I can query whether an element belongs to a queue." (and (not (&.member? number.Equivalence<Nat> sample non-member)) diff --git a/stdlib/test/test/lux/data/collection/set/ordered.lux b/stdlib/test/test/lux/data/collection/set/ordered.lux index 97127a3f3..261eebbb1 100644 --- a/stdlib/test/test/lux/data/collection/set/ordered.lux +++ b/stdlib/test/test/lux/data/collection/set/ordered.lux @@ -40,24 +40,24 @@ (test "Can query minimum value." (case [(&.min setL) minL] [#.None #.None] - true + #1 [(#.Some reference) (#.Some sample)] (n/= reference sample) _ - false)) + #0)) (test "Can query maximum value." (case [(&.max setL) maxL] [#.None #.None] - true + #1 [(#.Some reference) (#.Some sample)] (n/= reference sample) _ - false)) + #0)) (test "Converting sets to/from lists can't change their values." (|> setL diff --git a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux index 26311fbd1..28c7ec0f9 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux @@ -75,7 +75,7 @@ (|> zipper &.down &.rightmost &.leftmost &.value (is? pre-val)) (|> zipper &.down &.right &.left &.value (is? pre-val)) (|> zipper &.down &.rightmost &.value (is? post-val)))) - true))) + #1))) (test "Can insert children around a node (unless it's root)." (let [zipper (&.zip sample)] @@ -94,10 +94,10 @@ (|> zipper &.down &.rightmost &.leftmost &.value (is? pre-val)) (|> zipper &.down &.right &.left &.value (is? pre-val)) (|> zipper &.down &.rightmost &.value (is? post-val)))) - (and (|> zipper (&.insert-left pre-val) (case> (#.Some _) false - #.None true)) - (|> zipper (&.insert-right post-val) (case> (#.Some _) false - #.None true)))))) + (and (|> zipper (&.insert-left pre-val) (case> (#.Some _) #0 + #.None #1)) + (|> zipper (&.insert-right post-val) (case> (#.Some _) #0 + #.None #1)))))) (test "Can set and update the value of a node." (|> sample &.zip (&.set new-val) &.value (n/= new-val))) @@ -122,8 +122,8 @@ (let [zipper (&.zip sample)] (if (&.branch? zipper) (and (|> zipper &.down &.root? not) - (|> zipper &.down &.remove (case> #.None false + (|> zipper &.down &.remove (case> #.None #0 (#.Some node) (&.root? node)))) - (|> zipper &.remove (case> #.None true - (#.Some _) false))))) + (|> zipper &.remove (case> #.None #1 + (#.Some _) #0))))) )))) diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux index d86afc20b..7e64cc5ed 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/error.lux @@ -17,20 +17,20 @@ (test "Functor correctly handles both cases." (and (|> (: (&.Error Int) (#&.Success 10)) (&/map inc) - (case> (#&.Success 11) true _ false)) + (case> (#&.Success 11) #1 _ #0)) (|> (: (&.Error Int) (#&.Error "YOLO")) (&/map inc) - (case> (#&.Error "YOLO") true _ false)) + (case> (#&.Error "YOLO") #1 _ #0)) )) (test "Apply correctly handles both cases." (and (|> (&/wrap 20) - (case> (#&.Success 20) true _ false)) + (case> (#&.Success 20) #1 _ #0)) (|> (&/apply (&/wrap inc) (&/wrap 10)) - (case> (#&.Success 11) true _ false)) + (case> (#&.Success 11) #1 _ #0)) (|> (&/apply (&/wrap inc) (#&.Error "YOLO")) - (case> (#&.Error "YOLO") true _ false)))) + (case> (#&.Error "YOLO") #1 _ #0)))) (test "Monad correctly handles both cases." (and (|> (do &.Monad<Error> @@ -38,13 +38,13 @@ a (wrap 10) b (wrap 20)] (wrap (f a b))) - (case> (#&.Success 30) true _ false)) + (case> (#&.Success 30) #1 _ #0)) (|> (do &.Monad<Error> [f (wrap i/+) a (#&.Error "YOLO") b (wrap 20)] (wrap (f a b))) - (case> (#&.Error "YOLO") true _ false)) + (case> (#&.Error "YOLO") #1 _ #0)) )) ))) @@ -56,5 +56,5 @@ [a (lift (io/wrap 123)) b (wrap 456)] (wrap (i/+ a b)))) - (case> (#&.Success 579) true - _ false))))) + (case> (#&.Success 579) #1 + _ #0))))) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index f648dce28..086c13ece 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -73,7 +73,7 @@ (@/= sample result) (#.Left _) - false))) + #0))) )))) (type: Variant @@ -149,7 +149,7 @@ (f/= left' right') _ - false))] + #0))] (and (:: bit.Equivalence<Bit> = (get@ #bit recL) (get@ #bit recR)) (f/= (get@ #frac recL) (get@ #frac recR)) (:: text.Equivalence<Text> = (get@ #text recL) (get@ #text recR)) @@ -182,4 +182,4 @@ (@/= sample result) (#e.Error error) - false)))))) + #0)))))) diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index b757fe7e6..350718f0f 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -75,7 +75,7 @@ (&/= sample result) (#.Left error) - false))) + #0))) )))) (context: "Parsing." @@ -92,27 +92,27 @@ (list/map (|>> #&.Text) children))]] ($_ seq (test "Can parse text." - (E.default false + (E.default #0 (do E.Monad<Error> [output (&.run (#&.Text text) &.text)] (wrap (text/= text output))))) (test "Can parse attributes." - (E.default false + (E.default #0 (do E.Monad<Error> [output (|> (&.attr attr) (p.before &.ignore) (&.run node))] (wrap (text/= value output))))) (test "Can parse nodes." - (E.default false + (E.default #0 (do E.Monad<Error> [_ (|> (&.node tag) (p.before &.ignore) (&.run node))] - (wrap true)))) + (wrap #1)))) (test "Can parse children." - (E.default false + (E.default #0 (do E.Monad<Error> [outputs (|> (&.children (p.some &.text)) (&.run node))] diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index 0f8133721..e0e37d7a8 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -49,12 +49,12 @@ (|> ident1 &/encode &/decode (case> (#.Right dec-ident) (&/= ident1 dec-ident) - _ false))) + _ #0))) (test "Encoding an ident without a module component results in text equal to the name of the ident." (if (text.empty? module1) (text/= name1 (&/encode ident1)) - true)) + #1)) )))) (context: "Ident-related macros." diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux index 4401748cd..8e6680ad8 100644 --- a/stdlib/test/test/lux/data/maybe.lux +++ b/stdlib/test/test/lux/data/maybe.lux @@ -55,5 +55,5 @@ [a (lift (io/wrap 123)) b (wrap 456)] (wrap (i/+ a b)))) - (case> (#.Some 579) true - _ false))))) + (case> (#.Some 579) #1 + _ #0))))) diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index cc286dcd5..15bdbfd4c 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -84,10 +84,10 @@ (test "" (and (<= x (:: <Interval> bottom)) (>= x (:: <Interval> top)))))))] - ["Nat" r.nat Number<Nat> Order<Nat> Interval<Nat> (function (_ _) true)] - ["Int" r.int Number<Int> Order<Int> Interval<Int> (function (_ _) true)] + ["Nat" r.nat Number<Nat> Order<Nat> Interval<Nat> (function (_ _) #1)] + ["Int" r.int Number<Int> Order<Int> Interval<Int> (function (_ _) #1)] ## Both min and max values will be positive (thus, greater than zero) - ["Rev" r.rev Number<Rev> Order<Rev> Interval<Rev> (function (_ _) true)] + ["Rev" r.rev Number<Rev> Order<Rev> Interval<Rev> (function (_ _) #1)] ["Frac" r.frac Number<Frac> Order<Frac> Interval<Frac> (f/> 0.0)] ) @@ -104,18 +104,18 @@ (= x (compose x identity)) (= identity (compose identity identity)))))))] - ["Nat/Add" r.nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% +1000) (function (_ _) true)] - ["Nat/Mul" r.nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% +1000) (function (_ _) true)] - ["Nat/Min" r.nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% +1000) (function (_ _) true)] - ["Nat/Max" r.nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% +1000) (function (_ _) true)] - ["Int/Add" r.int Number<Int> Order<Int> Add@Monoid<Int> (i/% 1000) (function (_ _) true)] - ["Int/Mul" r.int Number<Int> Order<Int> Mul@Monoid<Int> (i/% 1000) (function (_ _) true)] - ["Int/Min" r.int Number<Int> Order<Int> Min@Monoid<Int> (i/% 1000) (function (_ _) true)] - ["Int/Max" r.int Number<Int> Order<Int> Max@Monoid<Int> (i/% 1000) (function (_ _) true)] - ["Rev/Add" r.rev Number<Rev> Order<Rev> Add@Monoid<Rev> (r/% .125) (function (_ _) true)] - ["Rev/Mul" r.rev Number<Rev> Order<Rev> Mul@Monoid<Rev> (r/% .125) (function (_ _) true)] - ["Rev/Min" r.rev Number<Rev> Order<Rev> Min@Monoid<Rev> (r/% .125) (function (_ _) true)] - ["Rev/Max" r.rev Number<Rev> Order<Rev> Max@Monoid<Rev> (r/% .125) (function (_ _) true)] + ["Nat/Add" r.nat Number<Nat> Order<Nat> Add@Monoid<Nat> (n/% +1000) (function (_ _) #1)] + ["Nat/Mul" r.nat Number<Nat> Order<Nat> Mul@Monoid<Nat> (n/% +1000) (function (_ _) #1)] + ["Nat/Min" r.nat Number<Nat> Order<Nat> Min@Monoid<Nat> (n/% +1000) (function (_ _) #1)] + ["Nat/Max" r.nat Number<Nat> Order<Nat> Max@Monoid<Nat> (n/% +1000) (function (_ _) #1)] + ["Int/Add" r.int Number<Int> Order<Int> Add@Monoid<Int> (i/% 1000) (function (_ _) #1)] + ["Int/Mul" r.int Number<Int> Order<Int> Mul@Monoid<Int> (i/% 1000) (function (_ _) #1)] + ["Int/Min" r.int Number<Int> Order<Int> Min@Monoid<Int> (i/% 1000) (function (_ _) #1)] + ["Int/Max" r.int Number<Int> Order<Int> Max@Monoid<Int> (i/% 1000) (function (_ _) #1)] + ["Rev/Add" r.rev Number<Rev> Order<Rev> Add@Monoid<Rev> (r/% .125) (function (_ _) #1)] + ["Rev/Mul" r.rev Number<Rev> Order<Rev> Mul@Monoid<Rev> (r/% .125) (function (_ _) #1)] + ["Rev/Min" r.rev Number<Rev> Order<Rev> Min@Monoid<Rev> (r/% .125) (function (_ _) #1)] + ["Rev/Max" r.rev Number<Rev> Order<Rev> Max@Monoid<Rev> (r/% .125) (function (_ _) #1)] ["Frac/Add" r.frac Number<Frac> Order<Frac> Add@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ["Frac/Mul" r.frac Number<Frac> Order<Frac> Mul@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ["Frac/Min" r.frac Number<Frac> Order<Frac> Min@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] @@ -135,7 +135,7 @@ (:: <Equivalence> = x x') (#.Left _) - false))))))] + #0))))))] ["Nat/Binary" r.nat Equivalence<Nat> Binary@Codec<Text,Nat>] ["Nat/Octal" r.nat Equivalence<Nat> Octal@Codec<Text,Nat>] diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index 0235a78b7..5be1942f2 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -113,4 +113,4 @@ (&.= sample output) _ - false)))))) + #0)))))) diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index 0cc9e36af..4f8cadac2 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -13,8 +13,8 @@ (let [(^open "List/") (list.Equivalence<List> text.Equivalence<Text>)] ($_ seq (test "Can inject values into Either." - (and (|> (left "Hello") (case> (+0 "Hello") true _ false)) - (|> (right "World") (case> (+1 "World") true _ false)))) + (and (|> (left "Hello") (case> (+0 "Hello") #1 _ #0)) + (|> (right "World") (case> (+1 "World") #1 _ #0)))) (test "Can discriminate eithers based on their cases." (let [[_lefts _rights] (partition (: (List (| Text Text)) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index c75b1bacd..478fb8c39 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -53,7 +53,7 @@ (&.contains? char sample)) _ - false + #0 )) )))) @@ -83,7 +83,7 @@ (= sample (&.concat (list _l _r)))) _ - false)) + #0)) (|> [(&.clip +0 sizeL sample) (&.clip sizeL (&.size sample) sample) @@ -96,7 +96,7 @@ (= sample _f)) _ - false)) + #0)) ) )))) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index 0d328cb0e..6c877da7b 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -13,11 +13,11 @@ (let [(^open "&/") text.Equivalence<Text>] ($_ seq (test "Can format common values simply." - (and (&/= "true" (%b true)) + (and (&/= "#1" (%b #1)) (&/= "+123" (%n +123)) (&/= "123" (%i 123)) (&/= "123.456" (%f 123.456)) (&/= ".5" (%r .5)) (&/= "\"YOLO\"" (%t "YOLO")) - (&/= "User-id: 123 -- Active: true" (format "User-id: " (%i 123) " -- Active: " (%b true))))) + (&/= "User-id: 123 -- Active: #1" (format "User-id: " (%i 123) " -- Active: " (%b #1))))) ))) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index b02082357..cab364c59 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -20,8 +20,8 @@ (def: (should-fail input) (All [a] (-> (E.Error a) Bit)) (case input - (#.Left _) true - _ false)) + (#.Left _) #1 + _ #0)) (def: (should-passT test input) (-> Text (E.Error Text) Bit) @@ -30,7 +30,7 @@ (text/= test output) _ - false)) + #0)) (def: (should-passL test input) (-> (List Text) (E.Error (List Text)) Bit) @@ -40,7 +40,7 @@ (list/= test output) _ - false))) + #0))) (def: (should-passE test input) (-> (Either Text Text) (E.Error (Either Text Text)) Bit) @@ -54,10 +54,10 @@ (text/= test output) _ - false) + #0) _ - false)) + #0)) ## [Tests] (context: "End" @@ -65,12 +65,12 @@ (test "Can detect the end of the input." (|> (&.run "" &.end) - (case> (#.Right _) true _ false))) + (case> (#.Right _) #1 _ #0))) (test "Won't mistake non-empty text for no more input." (|> (&.run "YOLO" &.end) - (case> (#.Left _) true _ false))) + (case> (#.Left _) #1 _ #0))) )) (context: "Literals" @@ -84,10 +84,10 @@ (test "Can find literal text fragments." (and (|> (&.run sample (&.this sample)) - (case> (#.Right []) true _ false)) + (case> (#.Right []) #1 _ #0)) (|> (&.run non-sample (&.this sample)) - (case> (#.Left _) true _ false)))) + (case> (#.Left _) #1 _ #0)))) )))) (context: "Custom lexers" @@ -166,8 +166,8 @@ (test "Can combine lexers sequentially." (and (|> (&.run "YO" (p.seq &.any &.any)) - (case> (#.Right ["Y" "O"]) true - _ false)) + (case> (#.Right ["Y" "O"]) #1 + _ #0)) (should-fail (&.run "Y" (p.seq &.any &.any))))) @@ -191,9 +191,9 @@ (test "Can lex using arbitrary predicates." (and (should-passT "D" (&.run "D" - (&.satisfies (function (_ c) true)))) + (&.satisfies (function (_ c) #1)))) (should-fail (&.run "C" - (&.satisfies (function (_ c) false)))))) + (&.satisfies (function (_ c) #0)))))) (test "Can apply a lexer multiple times." (and (should-passT "0123456789ABCDEF" (&.run "0123456789ABCDEF" diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index ff09a55db..dd13cee12 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -26,7 +26,7 @@ (text/= parsed input) _ - false))) + #0))) (def: (should-passT test regex input) (-> Text (lexer.Lexer Text) Text Bit) @@ -35,20 +35,20 @@ (text/= test parsed) _ - false))) + #0))) (def: (should-fail regex input) (All [a] (-> (lexer.Lexer a) Text Bit)) (|> (lexer.run input regex) - (case> (#.Left _) true _ false))) + (case> (#.Left _) #1 _ #0))) (syntax: (should-check pattern regex input) (wrap (list (` (|> (lexer.run (~ input) (~ regex)) (case> (^ (#.Right (~ pattern))) - true + #1 (~' _) - false)))))) + #0)))))) ## [Tests] (context: "Regular Expressions [Basics]" @@ -285,4 +285,4 @@ _ (test "Cannot pattern-match using regular-expressions." - false))))) + #0))))) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index d5469b9c2..5d233187d 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -35,7 +35,7 @@ (#private baz java/lang/Object) ## Methods (#public [] (new [value A]) [] - (exec (:= ::foo true) + (exec (:= ::foo #1) (:= ::bar value) (:= ::baz "") [])) @@ -92,7 +92,7 @@ (not (&.instance? Object (&.null))))) (test "Can run code in a \"synchronized\" block." - (&.synchronized "" true)) + (&.synchronized "" #1)) (test "Can access Class instances." (text/= "java.lang.Class" (Class::getName [] (&.class-for java/lang/Class)))) @@ -103,11 +103,11 @@ (test "Can safely convert nullable references into Maybe values." (and (|> (: (Maybe Object) (&.??? (&.null))) - (case> #.None true - _ false)) + (case> #.None #1 + _ #0)) (|> (: (Maybe Object) (&.??? "")) - (case> (#.Some _) true - _ false)))) + (case> (#.Some _) #1 + _ #0)))) )) (context: "Arrays" diff --git a/stdlib/test/test/lux/language/compiler/analysis/case.lux b/stdlib/test/test/lux/language/compiler/analysis/case.lux index 14b762271..adbacaa0e 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/case.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/case.lux @@ -47,7 +47,7 @@ (-> Bit (List [Code Code]) Code (r.Random (List Code))) (case inputC [_ (#.Bit _)] - (random/wrap (list (' true) (' false))) + (random/wrap (list (' #1) (' #0))) (^template [<tag> <gen> <wrapper>] [_ (<tag> _)] @@ -151,8 +151,8 @@ [outputT outputC] _primitive.primitive [heterogeneousT heterogeneousC] (r.filter (|>> product.left (check.checks? outputT) not) _primitive.primitive) - exhaustive-patterns (exhaustive-branches true variantTC inputC) - redundant-patterns (exhaustive-branches false variantTC inputC) + exhaustive-patterns (exhaustive-branches #1 variantTC inputC) + redundant-patterns (exhaustive-branches #0 variantTC inputC) redundancy-idx (|> r.nat (:: @ map (n/% (list.size redundant-patterns)))) heterogeneous-idx (|> r.nat (:: @ map (n/% (list.size exhaustive-patterns)))) #let [exhaustive-branchesC (list/map (branch outputC) @@ -172,10 +172,10 @@ (typeA.with-type outputT) analysis.with-scope (do compiler.Monad<Operation> - [_ (module.declare-tags variant-tags false + [_ (module.declare-tags variant-tags #0 (#.Named [module-name variant-name] (type.variant primitivesT))) - _ (module.declare-tags record-tags false + _ (module.declare-tags record-tags #0 (#.Named [module-name record-name] (type.tuple primitivesT)))]) (module.with-module +0 module-name))]] diff --git a/stdlib/test/test/lux/language/compiler/analysis/function.lux b/stdlib/test/test/lux/language/compiler/analysis/function.lux index 32ef59e3f..f3d8ce0dc 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/function.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/function.lux @@ -44,7 +44,7 @@ (n/= num-args (list.size argsA))) (#e.Error error) - false))) + #0))) (context: "Function definition." (<| (times +100) diff --git a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux index fadde9bb0..07510ae9d 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/primitive.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/primitive.lux @@ -69,7 +69,7 @@ (is? [] output) _ - false))) + #0))) (<| (times +100) (`` ($_ seq (~~ (do-template [<desc> <type> <tag> <random> <constructor>] @@ -81,7 +81,7 @@ (is? sample output) _ - false))))] + #0))))] ["bit" Bit #analysis.Bit r.bit code.bit] ["nat" Nat #analysis.Nat r.nat code.nat] diff --git a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux index 7ea4a23bd..19d1e8e96 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/procedure/common.lux @@ -41,8 +41,8 @@ (#e.Error error) <failure>)))] - [check-success+ true false] - [check-failure+ false true] + [check-success+ #1 #0] + [check-failure+ #0 #1] ) (context: "Lux procedures" @@ -185,10 +185,10 @@ (_primitive.analyse code)))) (compiler.run [analysisE.bundle (init.compiler [])]) (case> (#e.Success _) - true + #1 (#e.Error error) - false)))]] + #0)))]] ($_ seq (test "Can create arrays." (check-success+ "lux array new" (list sizeC) arrayT)) @@ -255,10 +255,10 @@ (_primitive.analyse (` ("lux atom read" (~ (code.symbol ["" var-name])))))))) (compiler.run [analysisE.bundle (init.compiler [])]) (case> (#e.Success _) - true + #1 (#e.Error _) - false))) + #0))) (test "Can swap the value of an atomic reference." (|> (scope.with-scope "" (scope.with-local [var-name atomT] @@ -269,10 +269,10 @@ (~ elemC))))))) (compiler.run [analysisE.bundle (init.compiler [])]) (case> (#e.Success _) - true + #1 (#e.Error _) - false))) + #0))) )))) (context: "Process procedures" diff --git a/stdlib/test/test/lux/language/compiler/analysis/reference.lux b/stdlib/test/test/lux/language/compiler/analysis/reference.lux index d68e2e8f4..0ae6dbe96 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/reference.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/reference.lux @@ -42,8 +42,8 @@ (#e.Error _) <on-failure>)))] - [success? true false] - [failure? false true] + [success? #1 #0] + [failure? #0 #1] ) (def: (reach-test var-name [export? def-module] [import? dependent-module] check!) @@ -52,7 +52,7 @@ [_ (module.with-module +0 def-module (module.define var-name [Any (if export? - (' {#.export? true}) + (' {#.export? #1}) (' {})) []]))] (module.with-module +0 dependent-module @@ -86,7 +86,7 @@ (n/= +0 var)) _ - false))) + #0))) (test "Can analyse definition (in the same module)." (let [def-name [def-module var-name]] (|> (do compiler.Monad<Operation> @@ -100,11 +100,11 @@ (ident/= def-name constant-name)) _ - false)))) + #0)))) (test "Can analyse definition (if exported from imported module)." - (reach-test var-name [true def-module] [true dependent-module] success?)) + (reach-test var-name [#1 def-module] [#1 dependent-module] success?)) (test "Cannot analyse definition (if not exported from imported module)." - (reach-test var-name [false def-module] [true dependent-module] failure?)) + (reach-test var-name [#0 def-module] [#1 dependent-module] failure?)) (test "Cannot analyse definition (if exported from non-imported module)." - (reach-test var-name [true def-module] [false dependent-module] failure?)) + (reach-test var-name [#1 def-module] [#0 dependent-module] failure?)) )))) diff --git a/stdlib/test/test/lux/language/compiler/analysis/structure.lux b/stdlib/test/test/lux/language/compiler/analysis/structure.lux index 8d8ce4cd0..3fb2d2455 100644 --- a/stdlib/test/test/lux/language/compiler/analysis/structure.lux +++ b/stdlib/test/test/lux/language/compiler/analysis/structure.lux @@ -44,8 +44,8 @@ _ <on-error>)))] - [check-succeeds true false] - [check-fails false true] + [check-succeeds #1 #0] + [check-fails #0 #1] ) (def: (check-sum' size tag variant) @@ -68,12 +68,12 @@ (check-sum' size tag variant) _ - false))) + #0))) (def: (tagged module tags type) (All [a] (-> Text (List module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do compiler.Monad<Operation> - [_ (module.declare-tags tags false type)]) + [_ (module.declare-tags tags #0 type)]) (module.with-module +0 module))) (def: (check-variant module tags type size tag analysis) @@ -88,7 +88,7 @@ (check-sum' size tag variant) _ - false))) + #0))) (def: (right-size? size) (-> Nat (-> Analysis Bit)) @@ -104,7 +104,7 @@ (right-size? size productA)) _ - false))) + #0))) (context: "Sums" (<| (times +100) @@ -140,7 +140,7 @@ (check-sum' size choice variant) _ - false))) + #0))) (test "Cannot analyse sum through unbound type-vars." (|> (do compiler.Monad<Operation> [[_ varT] (typeA.with-env check.var)] @@ -182,7 +182,7 @@ (right-size? size tupleA) _ - false))) + #0))) (test "Can infer product." (|> (typeA.with-inference (/.product ..analyse (list/map product.right primitives))) @@ -192,7 +192,7 @@ (right-size? size tupleA)) _ - false))) + #0))) (test "Can analyse pseudo-product (singleton tuple)" (|> (typeA.with-type singletonT (..analyse (` [(~ singletonC)]))) @@ -209,7 +209,7 @@ (right-size? size tupleA) _ - false))) + #0))) (test "Can analyse product through existential quantification." (|> (typeA.with-type (type.ex-q +1 +tupleT) (/.product ..analyse (list/map product.right +primitives))) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/case.lux b/stdlib/test/test/lux/language/compiler/synthesis/case.lux index ff84207a1..0f907f310 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/case.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/case.lux @@ -32,7 +32,7 @@ (expressionS.synthesizer extensionL.empty) (///compiler.run //.init) (error/map (//primitive.corresponds? maskedA)) - (error.default false)))))) + (error.default #0)))))) (context: "Let expressions." (<| (times +100) @@ -55,7 +55,7 @@ (//primitive.corresponds? outputA outputS)) _ - false)))))) + #0)))))) (context: "If expressions." (<| (times +100) @@ -65,10 +65,10 @@ thenA //primitive.primitive elseA //primitive.primitive #let [thenB (: Branch - [(#analysisL.Simple (#analysisL.Bit true)) + [(#analysisL.Simple (#analysisL.Bit #1)) thenA]) elseB (: Branch - [(#analysisL.Simple (#analysisL.Bit false)) + [(#analysisL.Simple (#analysisL.Bit #0)) elseA]) ifA (if then|else (analysisL.control/case [inputA [thenB (list elseB)]]) @@ -83,4 +83,4 @@ (//primitive.corresponds? elseA elseS)) _ - false)))))) + #0)))))) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/function.lux b/stdlib/test/test/lux/language/compiler/synthesis/function.lux index 0116033bd..0c55b64fd 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/function.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/function.lux @@ -88,7 +88,7 @@ (def: local-function (r.Random [Arity Analysis Variable]) (loop [arity +0 - nest? true] + nest? #1] (if nest? (do r.Monad<Random> [nest?' r.bit @@ -129,7 +129,7 @@ (variable/= prediction//environment output)) _ - false))) + #0))) (test "Folded functions properly offset local variables." (|> function//local (expressionS.synthesizer extensionL.empty) @@ -139,7 +139,7 @@ (variable/= prediction//local output)) _ - false))) + #0))) )))) (context: "Function application." @@ -159,7 +159,7 @@ (list.zip2 argsA argsS))) _ - false))) + #0))) (test "Function application on no arguments just synthesizes to the function itself." (|> (analysisL.apply [funcA (list)]) (expressionS.synthesizer extensionL.empty) @@ -168,5 +168,5 @@ (//primitive.corresponds? funcA funcS) _ - false))) + #0))) )))) diff --git a/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux b/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux index c804b94ff..0bf5d9765 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/primitive.lux @@ -64,7 +64,7 @@ (is? valueS valueA) _ - false)) + #0)) (context: "Primitives." (<| (times +100) @@ -85,7 +85,7 @@ (is? <sample> value) _ - false)))] + #0)))] ["unit" #analysisL.Unit #//.Text //.unit] ["bit" #analysisL.Bit #//.Bit %bit%] diff --git a/stdlib/test/test/lux/language/compiler/synthesis/structure.lux b/stdlib/test/test/lux/language/compiler/synthesis/structure.lux index db56757d1..d3845929c 100644 --- a/stdlib/test/test/lux/language/compiler/synthesis/structure.lux +++ b/stdlib/test/test/lux/language/compiler/synthesis/structure.lux @@ -39,7 +39,7 @@ (//primitive.corresponds? memberA valueS))) _ - false))) + #0))) )))) (context: "Tuples" @@ -58,5 +58,5 @@ (list.zip2 membersA membersS))) _ - false))) + #0))) )))) diff --git a/stdlib/test/test/lux/language/syntax.lux b/stdlib/test/test/lux/language/syntax.lux index 8c93867aa..110140e58 100644 --- a/stdlib/test/test/lux/language/syntax.lux +++ b/stdlib/test/test/lux/language/syntax.lux @@ -89,7 +89,7 @@ (case (&.read "" (dict.new text.Hash<Text>) [default-cursor +0 (code.to-text sample)]) (#e.Error error) - false + #0 (#e.Success [_ parsed]) (:: code.Equivalence<Code> = parsed sample))) @@ -98,13 +98,13 @@ [default-cursor +0 (format (code.to-text sample) " " (code.to-text other))]) (#e.Error error) - false + #0 (#e.Success [remaining =sample]) (case (&.read "" (dict.new text.Hash<Text>) remaining) (#e.Error error) - false + #0 (#e.Success [_ =other]) (and (:: code.Equivalence<Code> = sample =sample) @@ -129,7 +129,7 @@ (f/= expected actual) _ - false) + #0) )))) (context: "Nat special syntax." @@ -144,7 +144,7 @@ (n/= expected actual) _ - false) + #0) )))) (def: comment-text^ @@ -193,10 +193,10 @@ [default-cursor +0 (format "\"" bad-match "\"")]) (#e.Error error) - true + #1 (#e.Success [_ parsed]) - false))) + #0))) (test "Will accept valid multi-line text" (let [good-input (format (text.from-code x) "\n" offset (text.from-code y) "\n" @@ -209,7 +209,7 @@ +0 (format "\"" good-input "\"")]) (#e.Error error) - false + #0 (#e.Success [_ parsed]) (:: code.Equivalence<Code> = @@ -220,7 +220,7 @@ [default-cursor +0 (format comment (code.to-text sample))]) (#e.Error error) - false + #0 (#e.Success [_ parsed]) (:: code.Equivalence<Code> = parsed sample))) @@ -230,17 +230,17 @@ (format "#(" "#(" unbalanced-comment ")#" (code.to-text sample))]) (#e.Error error) - true + #1 (#e.Success [_ parsed]) - false) + #0) (case (&.read "" (dict.new text.Hash<Text>) [default-cursor +0 (format "#(" unbalanced-comment ")#" ")#" (code.to-text sample))]) (#e.Error error) - true + #1 (#e.Success [_ parsed]) - false))) + #0))) )))) diff --git a/stdlib/test/test/lux/language/type.lux b/stdlib/test/test/lux/language/type.lux index 5f2cff09b..631e3de09 100644 --- a/stdlib/test/test/lux/language/type.lux +++ b/stdlib/test/test/lux/language/type.lux @@ -55,13 +55,13 @@ (context: "Type application" (test "Can apply quantified types (universal and existential quantification)." - (and (maybe.default false + (and (maybe.default #0 (do maybe.Monad<Maybe> [partial (&.apply (list Bit) Ann) full (&.apply (list Int) partial)] (wrap (:: &.Equivalence<Type> = full (#.Product Bit Int))))) (|> (&.apply (list Bit) Text) - (case> #.None true _ false))))) + (case> #.None #1 _ #0))))) (context: "Naming" (let [base (#.Named ["" "a"] (#.Product Bit Int)) @@ -90,10 +90,10 @@ (r.filter (function (_ type) (case type (^or (#.Sum _) (#.Product _)) - false + #0 _ - true))) + #1))) (list.repeat size) (M.seq @)) #let [(^open "&/") &.Equivalence<Type> @@ -122,10 +122,10 @@ (r.filter (function (_ type) (case type (^or (#.Function _) (#.Apply _)) - false + #0 _ - true)))) + #1)))) #let [(^open "&/") &.Equivalence<Type> (^open "L/") (list.Equivalence<List> &.Equivalence<Type>)]] ($_ seq @@ -147,10 +147,10 @@ (r.filter (function (_ type) (case type (^or (#.UnivQ _) (#.ExQ _)) - false + #0 _ - true)))) + #1)))) #let [(^open "&/") &.Equivalence<Type>]] (with-expansions [<quant-tests> (do-template [<desc> <ctor> <dtor>] diff --git a/stdlib/test/test/lux/language/type/check.lux b/stdlib/test/test/lux/language/type/check.lux index c2db4533c..1faf59f16 100644 --- a/stdlib/test/test/lux/language/type/check.lux +++ b/stdlib/test/test/lux/language/type/check.lux @@ -56,7 +56,7 @@ (list.every? valid-type? params) (#.Ex id) - true + #1 (^template [<tag>] (<tag> left right) @@ -67,16 +67,16 @@ (valid-type? type') _ - false)) + #0)) (def: (type-checks? input) (-> (@.Check []) Bit) (case (@.run @.fresh-context input) (#.Right []) - true + #1 (#.Left error) - false)) + #0)) ## [Tests] (context: "Any and Nothing." @@ -210,7 +210,7 @@ (<| (times +100) (do @ [num-connections (|> r.nat (:: @ map (n/% +100))) - boundT (|> gen-type (r.filter (|>> (case> (#.Var _) false _ true)))) + boundT (|> gen-type (r.filter (|>> (case> (#.Var _) #0 _ #1)))) pick-pcg (r.seq r.nat r.nat)] ($_ seq (test "Can create rings of variables." diff --git a/stdlib/test/test/lux/macro/code.lux b/stdlib/test/test/lux/macro/code.lux index 0dfcd8fa0..1a7eba2b7 100644 --- a/stdlib/test/test/lux/macro/code.lux +++ b/stdlib/test/test/lux/macro/code.lux @@ -18,17 +18,17 @@ (and (text/= <text> (&.to-text <expr>)) (:: &.Equivalence<Code> = <expr> <expr>)))] - [(&.bit true) "true"] - [(&.bit false) "false"] - [(&.int 123) "123"] - [(&.frac 123.0) "123.0"] - [(&.text "\n") "\"\\n\""] - [(&.tag ["yolo" "lol"]) "#yolo.lol"] - [(&.symbol ["yolo" "lol"]) "yolo.lol"] - [(&.form (list (&.bit true) (&.int 123))) "(true 123)"] - [(&.tuple (list (&.bit true) (&.int 123))) "[true 123]"] - [(&.record (list [(&.bit true) (&.int 123)])) "{true 123}"] - [(&.local-tag "lol") "#lol"] - [(&.local-symbol "lol") "lol"] + [(&.bit #1) "#1"] + [(&.bit #0) "#0"] + [(&.int 123) "123"] + [(&.frac 123.0) "123.0"] + [(&.text "\n") "\"\\n\""] + [(&.tag ["yolo" "lol"]) "#yolo.lol"] + [(&.symbol ["yolo" "lol"]) "yolo.lol"] + [(&.form (list (&.bit #1) (&.int 123))) "(#1 123)"] + [(&.tuple (list (&.bit #1) (&.int 123))) "[#1 123]"] + [(&.record (list [(&.bit #1) (&.int 123)])) "{#1 123}"] + [(&.local-tag "lol") "#lol"] + [(&.local-symbol "lol") "lol"] )] ($_ seq <tests>))) diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux index 6d335701e..3bd4a0847 100644 --- a/stdlib/test/test/lux/macro/poly/functor.lux +++ b/stdlib/test/test/lux/macro/poly/functor.lux @@ -21,4 +21,4 @@ ## [Tests] (context: "Functor polytypism." (test "Can derive functors automatically." - true)) + #1)) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 35e25734f..c30157eb7 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -24,19 +24,19 @@ (-> (Syntax []) (List Code) Bit) (case (p.run input parser) (#.Right [_ []]) - true + #1 _ - false)) + #0)) (def: (found? parser input) (-> (Syntax Bit) (List Code) Bit) (case (p.run input parser) - (#.Right [_ true]) - true + (#.Right [_ #1]) + #1 _ - false)) + #0)) (def: (equals? Equivalence<a> reference parser input) (All [a] (-> (Equivalence a) a (Syntax a) (List Code) Bit)) @@ -45,24 +45,24 @@ (:: Equivalence<a> = reference output) _ - false)) + #0)) (def: (fails? input) (All [a] (-> (e.Error a) Bit)) (case input (#.Left _) - true + #1 _ - false)) + #0)) (syntax: (match pattern input) (wrap (list (` (case (~ input) (^ (#.Right [(~' _) (~ pattern)])) - true + #1 (~' _) - false))))) + #0))))) ## [Tests] (context: "Simple value syntax." @@ -73,7 +73,7 @@ (found? (s.this? (<ctor> <value>)) (list (<ctor> <value>))) (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))] - ["Can parse Bit syntax." true code.bit bit.Equivalence<Bit> s.bit] + ["Can parse Bit syntax." #1 code.bit bit.Equivalence<Bit> s.bit] ["Can parse Nat syntax." +123 code.nat number.Equivalence<Nat> s.nat] ["Can parse Int syntax." 123 code.int number.Equivalence<Int> s.int] ["Can parse Rev syntax." .123 code.rev number.Equivalence<Rev> s.rev] @@ -104,16 +104,16 @@ (with-expansions [<group-tests> (do-template [<type> <parser> <ctor>] [(test (format "Can parse " <type> " syntax.") - (and (match [true 123] - (p.run (list (<ctor> (list (code.bit true) (code.int 123)))) + (and (match [#1 123] + (p.run (list (<ctor> (list (code.bit #1) (code.int 123)))) (<parser> (p.seq s.bit s.int)))) - (match true - (p.run (list (<ctor> (list (code.bit true)))) + (match #1 + (p.run (list (<ctor> (list (code.bit #1)))) (<parser> s.bit))) - (fails? (p.run (list (<ctor> (list (code.bit true) (code.int 123)))) + (fails? (p.run (list (<ctor> (list (code.bit #1) (code.int 123)))) (<parser> s.bit))) - (match (#.Left true) - (p.run (list (<ctor> (list (code.bit true)))) + (match (#.Left #1) + (p.run (list (<ctor> (list (code.bit #1)))) (<parser> (p.alt s.bit s.int)))) (match (#.Right 123) (p.run (list (<ctor> (list (code.int 123)))) @@ -127,30 +127,30 @@ <group-tests> (test "Can parse record syntax." - (match [true 123] - (p.run (list (code.record (list [(code.bit true) (code.int 123)]))) + (match [#1 123] + (p.run (list (code.record (list [(code.bit #1) (code.int 123)]))) (s.record (p.seq s.bit s.int))))) ))) (context: "Combinators" ($_ seq (test "Can parse any Code." - (match [_ (#.Bit true)] - (p.run (list (code.bit true) (code.int 123)) + (match [_ (#.Bit #1)] + (p.run (list (code.bit #1) (code.int 123)) s.any))) (test "Can check whether the end has been reached." - (and (match true + (and (match #1 (p.run (list) s.end?)) - (match false - (p.run (list (code.bit true)) + (match #0 + (p.run (list (code.bit #1)) s.end?)))) (test "Can ensure the end has been reached." (and (match [] (p.run (list) s.end!)) - (fails? (p.run (list (code.bit true)) + (fails? (p.run (list (code.bit #1)) s.end!)))) )) diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index 4dc768cc2..a5501b737 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -16,21 +16,21 @@ right r.rev] ($_ seq (test "AND is the minimum." - (let [result (&.~and left right)] + (let [result (&.and left right)] (and (r/<= left result) (r/<= right result)))) (test "OR is the maximum." - (let [result (&.~or left right)] + (let [result (&.or left right)] (and (r/>= left result) (r/>= right result)))) (test "Double negation results in the original value." - (r/= left (&.~not (&.~not left)))) + (r/= left (&.not (&.not left)))) (test "Every value is equivalent to itself." (and (r/>= left - (&.~= left left)) + (&.= left left)) (r/>= right - (&.~= right right)))) + (&.= right right)))) )))) diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index 104c0cf76..55f5d0c67 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -15,7 +15,7 @@ ["r" random] [logic ["&" fuzzy] - continuous]]] + ["_" continuous]]]] lux/test) (do-template [<desc> <hash> <gen> <triangle> <lt> <lte> <gt> <gte>] @@ -39,19 +39,19 @@ triangle (<triangle> x y z)]] ($_ seq (test "The middle value will always have maximum membership." - (r/= ~true (&.membership middle triangle))) + (r/= _.true (&.membership middle triangle))) (test "Boundary values will always have 0 membership." - (and (r/= ~false (&.membership bottom triangle)) - (r/= ~false (&.membership top triangle)))) + (and (r/= _.false (&.membership bottom triangle)) + (r/= _.false (&.membership top triangle)))) (test "Values within range, will have membership > 0." - (bit/= (r/> ~false (&.membership sample triangle)) + (bit/= (r/> _.false (&.membership sample triangle)) (and (<gt> bottom sample) (<lt> top sample)))) (test "Values outside of range, will have membership = 0." - (bit/= (r/= ~false (&.membership sample triangle)) + (bit/= (r/= _.false (&.membership sample triangle)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] @@ -80,25 +80,25 @@ trapezoid (<trapezoid> w x y z)]] ($_ seq (test "The middle values will always have maximum membership." - (and (r/= ~true (&.membership middle-bottom trapezoid)) - (r/= ~true (&.membership middle-top trapezoid)))) + (and (r/= _.true (&.membership middle-bottom trapezoid)) + (r/= _.true (&.membership middle-top trapezoid)))) (test "Boundary values will always have 0 membership." - (and (r/= ~false (&.membership bottom trapezoid)) - (r/= ~false (&.membership top trapezoid)))) + (and (r/= _.false (&.membership bottom trapezoid)) + (r/= _.false (&.membership top trapezoid)))) (test "Values within inner range will have membership = 1" - (bit/= (r/= ~true (&.membership sample trapezoid)) + (bit/= (r/= _.true (&.membership sample trapezoid)) (and (<gte> middle-bottom sample) (<lte> middle-top sample)))) (test "Values within range, will have membership > 0." - (bit/= (r/> ~false (&.membership sample trapezoid)) + (bit/= (r/> _.false (&.membership sample trapezoid)) (and (<gt> bottom sample) (<lt> top sample)))) (test "Values outside of range, will have membership = 0." - (bit/= (r/= ~false (&.membership sample trapezoid)) + (bit/= (r/= _.false (&.membership sample trapezoid)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] @@ -139,7 +139,7 @@ (test "Complement membership is the opposite of normal membership." (r/= (&.membership sample left) - (~not (&.membership sample (&.complement left))))) + (_.not (&.membership sample (&.complement left))))) (test "Membership in the difference will never be higher than in the set being subtracted." (bit/= (r/> (&.membership sample right) @@ -156,12 +156,12 @@ ($_ seq (test "Values that satisfy a predicate have membership = 1. Values that don't have membership = 0." - (bit/= (r/= ~true (&.membership sample (&.from-predicate n/even?))) + (bit/= (r/= _.true (&.membership sample (&.from-predicate n/even?))) (n/even? sample))) (test "Values that belong to a set have membership = 1. Values that don't have membership = 0." - (bit/= (r/= ~true (&.membership sample (&.from-set set-10))) + (bit/= (r/= _.true (&.membership sample (&.from-set set-10))) (set.member? set-10 sample))) )))) @@ -175,7 +175,7 @@ member? (&.to-predicate threshold fuzzy)]] ($_ seq (test "Can increase the threshold of membership of a fuzzy set." - (bit/= (r/> ~false (&.membership sample vip-fuzzy)) + (bit/= (r/> _.false (&.membership sample vip-fuzzy)) (r/> threshold (&.membership sample fuzzy)))) (test "Can turn fuzzy sets into predicates through a threshold." diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux index 47b8b8aba..f54c2ef69 100644 --- a/stdlib/test/test/lux/math/modular.lux +++ b/stdlib/test/test/lux/math/modular.lux @@ -112,7 +112,7 @@ (/.m/= (/.mod normalM 1))) #.None - true)) + #1)) (test "Can encode/decode to text." (let [(^open "mod/") (/.Codec<Text,Mod> normalM)] @@ -121,7 +121,7 @@ (/.m/= subject output) (#e.Error error) - false))) + #0))) (test "Can equalize 2 moduli if they are equal." (case (/.equalize (/.mod normalM _subject) @@ -130,16 +130,16 @@ (/.m/= param paramC) (#e.Error error) - false)) + #0)) (test "Cannot equalize 2 moduli if they are the different." (case (/.equalize (/.mod normalM _subject) (/.mod alternativeM _param)) (#e.Success paramA) - false + #0 (#e.Error error) - true)) + #1)) (test "All numbers are congruent to themselves." (/.congruent? normalM _subject _subject)) diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux index 9f70e738f..5e92fffce 100644 --- a/stdlib/test/test/lux/time/date.lux +++ b/stdlib/test/test/lux/time/date.lux @@ -144,4 +144,4 @@ (@/= sample decoded) (#error.Error error) - false)))))) + #0)))))) diff --git a/stdlib/test/test/lux/time/duration.lux b/stdlib/test/test/lux/time/duration.lux index c5896b193..f746f9217 100644 --- a/stdlib/test/test/lux/time/duration.lux +++ b/stdlib/test/test/lux/time/duration.lux @@ -80,7 +80,7 @@ #let [(^open "@/") @.Equivalence<Duration> (^open "@/") @.Codec<Text,Duration>]] (test "Can encode/decode durations." - (E.default false + (E.default #0 (do E.Monad<Error> [decoded (|> sample @/encode @/decode)] (wrap (@/= sample decoded)))))))) diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux index 6914bd7b0..27161fa67 100644 --- a/stdlib/test/test/lux/time/instant.lux +++ b/stdlib/test/test/lux/time/instant.lux @@ -96,4 +96,4 @@ ## (@/= sample decoded) ## (#error.Error error) -## false)))))) +## #0)))))) diff --git a/stdlib/test/test/lux/type/object/protocol.lux b/stdlib/test/test/lux/type/object/protocol.lux index 2e2ae212f..fe463205d 100644 --- a/stdlib/test/test/lux/type/object/protocol.lux +++ b/stdlib/test/test/lux/type/object/protocol.lux @@ -46,7 +46,7 @@ (def: _test1 [Nat Object0] - (object0 (method1 [+0 "0" false]))) + (object0 (method1 [+0 "0" #0]))) (protocol: (Read a) (read [] a)) diff --git a/stdlib/test/test/lux/world/blob.lux b/stdlib/test/test/lux/world/blob.lux index ea9dc4087..24035bb0d 100644 --- a/stdlib/test/test/lux/world/blob.lux +++ b/stdlib/test/test/lux/world/blob.lux @@ -23,7 +23,7 @@ (-> (e.Error Bit) Bit) (case result (#e.Error _) - false + #0 (#e.Success output) output)) @@ -85,5 +85,5 @@ (:: (list.Equivalence<List> number.Equivalence<Nat>) = slice-vals blob-vals) _ - false)))) + #0)))) )))) diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux index 6f508baaa..43b62ac3f 100644 --- a/stdlib/test/test/lux/world/file.lux +++ b/stdlib/test/test/lux/world/file.lux @@ -48,7 +48,7 @@ (wrap (and (not pre!) post! (not remains?)))))] (assert "Can create/delete files." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +1 code)))] result (promise.future @@ -58,7 +58,7 @@ _ (:: @.JVM@System delete file)] (wrap (:: blob.Equivalence<Blob> = dataL output))))] (assert "Can write/read files." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +2 code)))] result (promise.future @@ -68,7 +68,7 @@ _ (:: @.JVM@System delete file)] (wrap (n/= file-size read-size))))] (assert "Can read file size." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +3 code)))] result (promise.future @@ -82,7 +82,7 @@ (:: blob.Equivalence<Blob> = dataL (error.assume (blob.slice +0 (dec file-size) output))) (:: blob.Equivalence<Blob> = dataR (error.assume (blob.slice file-size (dec read-size) output)))))))] (assert "Can append to files." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [dir (format "temp_dir_" (%n (n/+ +4 code)))] result (promise.future @@ -95,7 +95,7 @@ (wrap (and (not pre!) post! (not remains?)))))] (assert "Can create/delete directories." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +5 code))) dir (format "temp_dir_" (%n (n/+ +5 code)))] @@ -112,7 +112,7 @@ (wrap (and file-is-file (not file-is-directory) (not directory-is-file) directory-is-directory))))] (assert "Can differentiate files from directories." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +6 code))) dir (format "temp_dir_" (%n (n/+ +6 code)))] @@ -126,7 +126,7 @@ _ (:: @.JVM@System delete dir)] (wrap (n/= file-size read-size))))] (assert "Can create files inside of directories." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +7 code))) dir (format "temp_dir_" (%n (n/+ +7 code)))] @@ -143,9 +143,9 @@ (text.ends-with? file' child) _ - false))))] + #0))))] (assert "Can list files inside a directory." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file (format "temp_file_" (%n (n/+ +8 code)))] result (promise.future @@ -156,7 +156,7 @@ _ (:: @.JVM@System delete file)] (wrap (:: instant.Equivalence<Instant> = last-modified time-read))))] (assert "Can change the time of last modification." - (error.default false result)))) + (error.default #0 result)))) (wrap (do promise.Monad<Promise> [#let [file0 (format "temp_file_" (%n (n/+ +9 code)) "0") file1 (format "temp_file_" (%n (n/+ +9 code)) "1")] @@ -170,5 +170,5 @@ _ (:: @.JVM@System delete file1)] (wrap (and pre! (not post!) confirmed?))))] (assert "Can move a file from one path to another." - (error.default false result)))) + (error.default #0 result)))) ))) diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index 1c315c7f5..b72364e5b 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -66,5 +66,5 @@ (wrap (and from-worked? to-worked?)))] (assert "Can communicate between client and server." - (E.default false result)))) + (E.default #0 result)))) ))) diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index b1685ebc7..a00b75dbf 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -59,5 +59,5 @@ (wrap (and from-worked? to-worked?)))] (assert "Can communicate between client and server." - (E.default false result)))) + (E.default #0 result)))) ))) |