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/source | |
parent | 69fefab57c40f323d759dc444dbcebad15071585 (diff) |
- New syntax for bit values: "#0" and "#1", instead of "false" and "true".
- Small improvements to lux-mode.
Diffstat (limited to '')
61 files changed, 430 insertions, 418 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)])]))) |