diff options
Diffstat (limited to '')
150 files changed, 1718 insertions, 1727 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index dd5a42064..109a590e3 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1,194 +1,194 @@ ("lux def" dummy-cursor - ("lux check" (|2 (|0 "#Text" (|0)) - (|2 (|0 "#I64" (|1 (|0 "#Nat" (|0)) (|0))) - (|0 "#I64" (|1 (|0 "#Nat" (|0)) (|0))))) - ["" |0 |0]) - [["" |0 |0] - (|10 (|1 [[["" |0 |0] (|7 ["lux" "export?"])] - [["" |0 |0] (|0 #1)]] - (|0)))]) + ("lux check" (2 (0 "#Text" (0)) + (2 (0 "#I64" (1 (0 "#Nat" (0)) (0))) + (0 "#I64" (1 (0 "#Nat" (0)) (0))))) + ["" 0 0]) + [["" 0 0] + (10 (1 [[["" 0 0] (7 ["lux" "export?"])] + [["" 0 0] (0 #1)]] + (0)))]) ## (type: Any ## (Ex [a] a)) ("lux def" Any - (|10 ["lux" "Any"] - (|8 (|0) (|4 |1))) + (10 ["lux" "Any"] + (8 (0) (4 1))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things whose type does not matter. + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things whose type does not matter. It can be used to write functions or data-structures that can take, or return, anything.")]] - (|0)))))]) + (0)))))]) ## (type: Nothing ## (All [a] a)) ("lux def" Nothing - (|10 ["lux" "Nothing"] - (|7 (|0) (|4 |1))) + (10 ["lux" "Nothing"] + (7 (0) (4 1))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things whose type is unknown or undefined. + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things whose type is unknown or undefined. Useful for expressions that cause errors or other \"extraordinary\" conditions.")]] - (|0)))))]) + (0)))))]) ## (type: (List a) ## #Nil ## (#Cons a (List a))) ("lux def" List - (|10 ["lux" "List"] - (|7 (|0) - (|1 ## "lux.Nil" - Any - ## "lux.Cons" - (|2 (|4 |1) - (|9 (|4 |1) (|4 |0)))))) + (10 ["lux" "List"] + (7 (0) + (1 ## "lux.Nil" + Any + ## "lux.Cons" + (2 (4 1) + (9 (4 1) (4 0)))))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [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"])] - [dummy-cursor (|9 (|1 [dummy-cursor (|5 "a")] (|0)))]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A potentially empty list of values.")]] - (|0)))))))]) + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [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"])] + [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially empty list of values.")]] + (0)))))))]) ("lux def" Bit - (|10 ["lux" "Bit"] - (|0 "#Bit" #Nil)) + (10 ["lux" "Bit"] + (0 "#Bit" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill boolean values (as bits).")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]] + #Nil))))]) ("lux def" I64 - (|10 ["lux" "I64"] - (|7 (|0) - (|0 "#I64" (#Cons (|4 |1) #Nil)))) + (10 ["lux" "I64"] + (7 (0) + (0 "#I64" (#Cons (4 1) #Nil)))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "64-bit integers without any semantics.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "64-bit integers without any semantics.")]] + #Nil))))]) ("lux def" Nat - (|10 ["lux" "Nat"] - (|0 "#I64" (#Cons (|0 "#Nat" #Nil) #Nil))) + (10 ["lux" "Nat"] + (0 "#I64" (#Cons (0 "#Nat" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Natural numbers (unsigned integers). + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Natural numbers (unsigned integers). - They start at zero (|0) and extend in the positive direction.")]] - #Nil))))]) + They start at zero (0) and extend in the positive direction.")]] + #Nil))))]) ("lux def" Int - (|10 ["lux" "Int"] - (|0 "#I64" (#Cons (|0 "#Int" #Nil) #Nil))) + (10 ["lux" "Int"] + (0 "#I64" (#Cons (0 "#Int" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill integer numbers.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]] + #Nil))))]) ("lux def" Rev - (|10 ["lux" "Rev"] - (|0 "#I64" (#Cons (|0 "#Rev" #Nil) #Nil))) + (10 ["lux" "Rev"] + (0 "#I64" (#Cons (0 "#Rev" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Fractional numbers that live in the interval [0,1). + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Fractional numbers that live in the interval [0,1). Useful for probability, and other domains that work within that interval.")]] - #Nil))))]) + #Nil))))]) ("lux def" Frac - (|10 ["lux" "Frac"] - (|0 "#Frac" #Nil)) + (10 ["lux" "Frac"] + (0 "#Frac" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] + #Nil))))]) ("lux def" Text - (|10 ["lux" "Text"] - (|0 "#Text" #Nil)) + (10 ["lux" "Text"] + (0 "#Text" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill string values.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]] + #Nil))))]) ("lux def" Name - (|10 ["lux" "Name"] - (|2 Text Text)) + (10 ["lux" "Name"] + (2 Text Text)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A name. + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]] - #Nil))))]) + #Nil))))]) ## (type: (Maybe a) ## #None ## (#Some a)) ("lux def" Maybe - (|10 ["lux" "Maybe"] - (|7 #Nil - (|1 ## "lux.None" - Any - ## "lux.Some" - (|4 |1)))) + (10 ["lux" "Maybe"] + (7 #Nil + (1 ## "lux.None" + Any + ## "lux.Some" + (4 1)))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [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"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "a")] #Nil))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A potentially missing value.")]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [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"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially missing value.")]] + #Nil))))))]) ## (type: #rec Type ## (#Primitive Text (List Type)) @@ -204,60 +204,60 @@ ## (#Named Name Type) ## ) ("lux def" Type - (|10 ["lux" "Type"] - ({Type - ({Type-List - ({Type-Pair - (|9 Nothing - (|7 #Nil - (|1 ## "lux.Primitive" - (|2 Text Type-List) - (|1 ## "lux.Sum" - Type-Pair - (|1 ## "lux.Product" - Type-Pair - (|1 ## "lux.Function" - Type-Pair - (|1 ## "lux.Parameter" - Nat - (|1 ## "lux.Var" - Nat - (|1 ## "lux.Ex" - Nat - (|1 ## "lux.UnivQ" - (|2 Type-List Type) - (|1 ## "lux.ExQ" - (|2 Type-List Type) - (|1 ## "lux.Apply" - Type-Pair - ## "lux.Named" - (|2 Name Type)))))))))))))} - ("lux check type" (|2 Type Type)))} - ("lux check type" (|9 Type List)))} - ("lux check type" (|9 (|4 |1) (|4 |0))))) + (10 ["lux" "Type"] + ({Type + ({Type-List + ({Type-Pair + (9 Nothing + (7 #Nil + (1 ## "lux.Primitive" + (2 Text Type-List) + (1 ## "lux.Sum" + Type-Pair + (1 ## "lux.Product" + Type-Pair + (1 ## "lux.Function" + Type-Pair + (1 ## "lux.Parameter" + Nat + (1 ## "lux.Var" + Nat + (1 ## "lux.Ex" + Nat + (1 ## "lux.UnivQ" + (2 Type-List Type) + (1 ## "lux.ExQ" + (2 Type-List Type) + (1 ## "lux.Apply" + Type-Pair + ## "lux.Named" + (2 Name Type)))))))))))))} + ("lux check type" (2 Type Type)))} + ("lux check type" (9 Type List)))} + ("lux check type" (9 (4 1) (4 0))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "Primitive")] - (#Cons [dummy-cursor (|5 "Sum")] - (#Cons [dummy-cursor (|5 "Product")] - (#Cons [dummy-cursor (|5 "Function")] - (#Cons [dummy-cursor (|5 "Parameter")] - (#Cons [dummy-cursor (|5 "Var")] - (#Cons [dummy-cursor (|5 "Ex")] - (#Cons [dummy-cursor (|5 "UnivQ")] - (#Cons [dummy-cursor (|5 "ExQ")] - (#Cons [dummy-cursor (|5 "Apply")] - (#Cons [dummy-cursor (|5 "Named")] - #Nil))))))))))))]] - (#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 #1)]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "Primitive")] + (#Cons [dummy-cursor (5 "Sum")] + (#Cons [dummy-cursor (5 "Product")] + (#Cons [dummy-cursor (5 "Function")] + (#Cons [dummy-cursor (5 "Parameter")] + (#Cons [dummy-cursor (5 "Var")] + (#Cons [dummy-cursor (5 "Ex")] + (#Cons [dummy-cursor (5 "UnivQ")] + (#Cons [dummy-cursor (5 "ExQ")] + (#Cons [dummy-cursor (5 "Apply")] + (#Cons [dummy-cursor (5 "Named")] + #Nil))))))))))))]] + (#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 #1)]] + #Nil))))))]) ## (type: Cursor ## {#module Text @@ -267,18 +267,18 @@ (#Named ["lux" "Cursor"] (#Product Text (#Product Nat Nat))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "module")] - (#Cons [dummy-cursor (|5 "line")] - (#Cons [dummy-cursor (|5 "column")] - #Nil))))]] - (#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 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil)))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "module")] + (#Cons [dummy-cursor (5 "line")] + (#Cons [dummy-cursor (5 "column")] + #Nil))))]] + (#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 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil)))))]) ## (type: (Ann m v) ## {#meta m @@ -287,22 +287,22 @@ (#Named ["lux" "Ann"] (#UnivQ #Nil (#UnivQ #Nil - (#Product (#Parameter |3) - (#Parameter |1))))) + (#Product (#Parameter 3) + (#Parameter 1))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "meta")] - (#Cons [dummy-cursor (|5 "datum")] - #Nil)))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things that can be annotated with meta-data of arbitrary types.")]] - (#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 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "meta")] + (#Cons [dummy-cursor (5 "datum")] + #Nil)))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things that can be annotated with meta-data of arbitrary types.")]] + (#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 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil))))))]) ## (type: (Code' w) ## (#Bit Bit) @@ -346,30 +346,30 @@ )))))))))) )} ("lux check type" (#Apply Code List)))} - ("lux check type" (#Apply (#Apply (#Parameter |1) - (#Parameter |0)) - (#Parameter |1))))) + ("lux check type" (#Apply (#Apply (#Parameter 1) + (#Parameter 0)) + (#Parameter 1))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "Bit")] - (#Cons [dummy-cursor (|5 "Nat")] - (#Cons [dummy-cursor (|5 "Int")] - (#Cons [dummy-cursor (|5 "Rev")] - (#Cons [dummy-cursor (|5 "Frac")] - (#Cons [dummy-cursor (|5 "Text")] - (#Cons [dummy-cursor (|5 "Identifier")] - (#Cons [dummy-cursor (|5 "Tag")] - (#Cons [dummy-cursor (|5 "Form")] - (#Cons [dummy-cursor (|5 "Tuple")] - (#Cons [dummy-cursor (|5 "Record")] - #Nil))))))))))))]] - (#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 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil)))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "Bit")] + (#Cons [dummy-cursor (5 "Nat")] + (#Cons [dummy-cursor (5 "Int")] + (#Cons [dummy-cursor (5 "Rev")] + (#Cons [dummy-cursor (5 "Frac")] + (#Cons [dummy-cursor (5 "Text")] + (#Cons [dummy-cursor (5 "Identifier")] + (#Cons [dummy-cursor (5 "Tag")] + (#Cons [dummy-cursor (5 "Form")] + (#Cons [dummy-cursor (5 "Tuple")] + (#Cons [dummy-cursor (5 "Record")] + #Nil))))))))))))]] + (#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 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil)))))]) ## (type: Code ## (Ann Cursor (Code' (Ann Cursor)))) @@ -490,8 +490,8 @@ (#Product ## "lux.counter" Nat ## "lux.mappings" - (#Apply (#Product (#Parameter |3) - (#Parameter |1)) + (#Apply (#Product (#Parameter 3) + (#Parameter 1)) List))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "counter") (#Cons (text$ "mappings") #Nil)))] @@ -543,9 +543,9 @@ (#UnivQ #Nil (#UnivQ #Nil (#Sum ## "lux.Left" - (#Parameter |3) + (#Parameter 3) ## "lux.Right" - (#Parameter |1))))) + (#Parameter 1))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "Left") (#Cons (text$ "Right") #Nil)))] (#Cons [(tag$ ["lux" "type-args"]) @@ -760,7 +760,7 @@ (#Named ["lux" "Meta"] (#UnivQ #Nil (#Function Lux - (#Apply (#Product Lux (#Parameter |1)) + (#Apply (#Product Lux (#Parameter 1)) (#Apply Text Either))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Computations that can have access to the state of the compiler. @@ -782,10 +782,10 @@ ## Base functions & macros ("lux def" return ("lux check" (#UnivQ #Nil - (#Function (#Parameter |1) + (#Function (#Parameter 1) (#Function Lux (#Apply (#Product Lux - (#Parameter |1)) + (#Parameter 1)) (#Apply Text Either))))) ([_ val] ([_ state] @@ -797,7 +797,7 @@ (#Function Text (#Function Lux (#Apply (#Product Lux - (#Parameter |1)) + (#Parameter 1)) (#Apply Text Either))))) ([_ msg] ([_ state] @@ -861,7 +861,7 @@ ("lux def" cursor-code ("lux check" Code - (tuple$ (#Cons (text$ "") (#Cons (nat$ |0) (#Cons (nat$ |0) #Nil))))) + (tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil))))) (record$ #Nil)) ("lux def" meta-code @@ -1052,9 +1052,9 @@ #Nil (#UnivQ #Nil (#UnivQ #Nil - (#Function (#Function (#Parameter |3) (#Parameter |1)) - (#Function ($' List (#Parameter |3)) - ($' List (#Parameter |1)))))) + (#Function (#Function (#Parameter 3) (#Parameter 1)) + (#Function ($' List (#Parameter 3)) + ($' List (#Parameter 1)))))) ({#Nil #Nil @@ -1164,7 +1164,7 @@ pairs)) [_ (#Form (#Cons [_ (#Tag "lux" "Parameter")] (#Cons [_ (#Nat idx)] #Nil)))] - (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ |2 idx)) #Nil))) + (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ 2 idx)) #Nil))) [_ (#Form members)] (form$ (list/map update-parameters members)) @@ -1198,12 +1198,12 @@ (def:'' (list/fold f init xs) #Nil ## (All [a b] (-> (-> b a a) a (List b) a)) - (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter |1) - (#Function (#Parameter |3) - (#Parameter |3))) - (#Function (#Parameter |3) - (#Function ($' List (#Parameter |1)) - (#Parameter |3)))))) + (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter 1) + (#Function (#Parameter 3) + (#Parameter 3))) + (#Function (#Parameter 3) + (#Function ($' List (#Parameter 1)) + (#Parameter 3)))))) ({#Nil init @@ -1214,8 +1214,8 @@ (def:'' (list/size list) #Nil (#UnivQ #Nil - (#Function ($' List (#Parameter |1)) Nat)) - (list/fold (function'' [_ acc] (n/+ |1 acc)) |0 list)) + (#Function ($' List (#Parameter 1)) Nat)) + (list/fold (function'' [_ acc] (n/+ 1 acc)) 0 list)) (macro:' #export (All tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1241,7 +1241,7 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-parameter |1)] #Nil) + (#Cons (replace-syntax (#Cons [name' (make-parameter 1)] #Nil) (update-parameters body')) #Nil)))))) body names) @@ -1252,7 +1252,7 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* |2 (n/- |1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 (n/- 1 (list/size names))))] #Nil) body')} [(text/= "" self-name) names]) @@ -1288,7 +1288,7 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-parameter |1)] #Nil) + (#Cons (replace-syntax (#Cons [name' (make-parameter 1)] #Nil) (update-parameters body')) #Nil)))))) body names) @@ -1299,7 +1299,7 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* |2 (n/- |1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 (n/- 1 (list/size names))))] #Nil) body')} [(text/= "" self-name) names]) @@ -1518,7 +1518,7 @@ (def:''' (wrap-meta content) #Nil (-> Code Code) - (tuple$ (list (tuple$ (list (text$ "") (nat$ |0) (nat$ |0))) + (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) content))) (def:''' (untemplate-list tokens) @@ -2199,14 +2199,14 @@ (def:''' (high-bits value) (list) (-> ($' I64 Any) I64) - ("lux i64 logical-right-shift" |32 value)) + ("lux i64 logical-right-shift" 32 value)) (def:''' low-mask (list) I64 - (|> |1 - ("lux i64 left-shift" |32) - ("lux i64 -" |1))) + (|> 1 + ("lux i64 left-shift" 32) + ("lux i64 -" 1))) (def:''' (low-bits value) (list) @@ -2366,12 +2366,12 @@ (-> Nat Nat Nat) (if ("lux int <" ("lux coerce" Int param) +0) (if (n/< param subject) - |0 - |1) + 0 + 1) (let' [quotient ("lux i64 left-shift" - |1 + 1 ("lux int /" - ("lux i64 logical-right-shift" |1 subject) + ("lux i64 logical-right-shift" 1 subject) ("lux coerce" Int param))) flat ("lux int *" ("lux coerce" Int quotient) @@ -2379,7 +2379,7 @@ remainder ("lux i64 -" flat subject)] (if (n/< param remainder) quotient - ("lux i64 +" |1 quotient))))) + ("lux i64 +" 1 quotient))))) (def:''' #export (n//% param subject) (list [(tag$ ["lux" "doc"]) @@ -2442,7 +2442,7 @@ paramL (low-bits param) bottom (|> subjectL ("lux int *" paramL) - ("lux i64 logical-right-shift" |32)) + ("lux i64 logical-right-shift" 32)) middle ("lux i64 +" ("lux int *" subjectH paramL) ("lux int *" subjectL paramH)) @@ -2452,17 +2452,17 @@ high-bits ("lux i64 +" top)))) -(def:''' least-significant-bit-mask (list) Nat |1) +(def:''' least-significant-bit-mask (list) Nat 1) (def:''' (without-trailing-zeroes count remaining) (list) (-> Nat Nat (#Product Nat Nat)) (if (|> remaining ("lux i64 and" least-significant-bit-mask) - ("lux i64 =" |0)) + ("lux i64 =" 0)) (without-trailing-zeroes - ("lux i64 +" |1 count) - ("lux i64 logical-right-shift" |1 remaining)) + ("lux i64 +" 1 count) + ("lux i64 logical-right-shift" 1 remaining)) [count remaining])) (def:''' #export (r// param subject) @@ -2471,13 +2471,13 @@ (-> Rev Rev Rev) (if ("lux i64 =" +0 param) ("lux io error" "Cannot divide Rev by zero!") - (let' [[trailing-zeroes remaining] (without-trailing-zeroes |0 ("lux coerce" Nat param)) + (let' [[trailing-zeroes remaining] (without-trailing-zeroes 0 ("lux coerce" Nat param)) [trailing-zeroes denominator] ("lux check" (#Product Nat Nat) (if ("lux i64 =" +0 trailing-zeroes) - [|1 ("lux i64 logical-right-shift" |1 remaining)] + [1 ("lux i64 logical-right-shift" 1 remaining)] [trailing-zeroes remaining])) - shift ("lux i64 -" trailing-zeroes |64) - numerator ("lux i64 left-shift" shift |1)] + shift ("lux i64 -" trailing-zeroes 64) + numerator ("lux i64 left-shift" shift 1)] ("lux coerce" Rev ("lux int *" ("lux coerce" Int subject) @@ -2507,10 +2507,10 @@ (text$ "Rev(olution) reciprocal of a Nat(ural).")]) (-> Nat Rev) ("lux coerce" Rev - (let' [[trailing-zeroes remaining] (without-trailing-zeroes |0 numerator)] + (let' [[trailing-zeroes remaining] (without-trailing-zeroes 0 numerator)] (n// remaining - ({|0 ("lux coerce" Nat -1) - _ ("lux i64 left-shift" (n/- trailing-zeroes |64) |1)} + ({0 ("lux coerce" Nat -1) + _ ("lux i64 left-shift" (n/- trailing-zeroes 64) 1)} trailing-zeroes))))) (do-template [<name> <type> <test> <doc>] @@ -2543,26 +2543,26 @@ (def:''' (digit-to-text digit) #Nil (-> Nat Text) - ({|0 "0" - |1 "1" |2 "2" |3 "3" - |4 "4" |5 "5" |6 "6" - |7 "7" |8 "8" |9 "9" + ({0 "0" + 1 "1" 2 "2" 3 "3" + 4 "4" 5 "5" 6 "6" + 7 "7" 8 "8" 9 "9" _ ("lux io error" "undefined")} digit)) (def:''' (nat/encode value) #Nil (-> Nat Text) - ({|0 - "|0" + ({0 + "0" _ (let' [loop ("lux check" (-> Nat Text Text) (function' recur [input output] - (if (n/= |0 input) + (if (n/= 0 input) (text/compose "|" output) - (recur (n// |10 input) - (text/compose (|> input (n/% |10) digit-to-text) + (recur (n// 10 input) + (text/compose (|> input (n/% 10) digit-to-text) output)))))] (loop value ""))} value)) @@ -2600,7 +2600,7 @@ (def:''' (multiple? div n) #Nil (-> Nat Nat Bit) - (|> n (n/% div) (n/= |0))) + (|> n (n/% div) (n/= 0))) (def:''' #export (not x) (list [(tag$ ["lux" "doc"]) @@ -2935,7 +2935,7 @@ #scope-type-vars scope-type-vars} (#Right {#info info #source source #current-module _ #modules modules #scopes scopes #type-context types #host host - #seed (n/+ |1 seed) #expected expected + #seed (n/+ 1 seed) #expected expected #cursor cursor #extensions extensions #scope-type-vars scope-type-vars} (identifier$ ["" ($_ text/compose "__gensym__" prefix (nat/encode seed))]))} @@ -2948,7 +2948,7 @@ (Rec Self [Int (List Self)])")]) ({(#Cons [_ (#Identifier "" name)] (#Cons body #Nil)) - (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter |1)) (~ (make-parameter |0))))]) + (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter 1)) (~ (make-parameter 0))))]) (update-parameters body))] (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) @@ -3209,7 +3209,7 @@ (op x y))")]) (case tokens (^ (list [_ (#Tuple bindings)] body)) - (if (multiple? |2 (list/size bindings)) + (if (multiple? 2 (list/size bindings)) (|> bindings as-pairs list/reverse (list/fold (: (-> [Code Code] Code Code) (function' [lr body'] @@ -3573,7 +3573,7 @@ (def: (index-of part text) (-> Text Text (Maybe Nat)) - ("lux text index" text part |0)) + ("lux text index" text part 0)) (def: (last-index-of' part part-size since text) (-> Text Nat Nat Text (Maybe Nat)) @@ -3586,7 +3586,7 @@ (def: (last-index-of part text) (-> Text Text (Maybe Nat)) - (case ("lux text index" text part |0) + (case ("lux text index" text part 0) (#Some since) (last-index-of' part ("lux text size" part) since text) @@ -3635,10 +3635,10 @@ (#Some idx) (list& (default (error! "UNDEFINED") - (clip2 |0 idx input)) + (clip2 0 idx input)) (text/split splitter (default (error! "UNDEFINED") - (clip1 (n/+ |1 idx) input)))))) + (clip1 (n/+ 1 idx) input)))))) (def: (nth idx xs) (All [a] @@ -3648,9 +3648,9 @@ #None (#Cons x xs') - (if (n/= |0 idx) + (if (n/= 0 idx) (#Some x) - (nth (n/- |1 idx) xs') + (nth (n/- 1 idx) xs') ))) (def: (beta-reduce env type) @@ -4132,7 +4132,7 @@ (def: (split at x) (-> Nat Text (Maybe [Text Text])) - (case [(..clip2 |0 at x) (..clip1 at x)] + (case [(..clip2 0 at x) (..clip1 at x)] [(#.Some pre) (#.Some post)] (#.Some [pre post]) @@ -4170,38 +4170,38 @@ (#Some found) (if (n/= ups found) - (count-ups (n/+ |1 ups) input) + (count-ups (n/+ 1 ups) input) ups))) (def: (list/drop amount a+) (All [a] (-> Nat (List a) (List a))) (case [amount a+] - (^or [|0 _] [_ #Nil]) + (^or [0 _] [_ #Nil]) a+ [_ (#Cons _ a+')] - (list/drop (n/- |1 amount) a+'))) + (list/drop (n/- 1 amount) a+'))) (def: (clean-module nested? relative-root module) (-> Bit Text Text (Meta Text)) - (case (count-ups |0 module) - |0 + (case (count-ups 0 module) + 0 (return (if nested? ($_ "lux text concat" relative-root "/" module) module)) ups (let [parts (text/split "/" relative-root)] - (if (n/< (list/size parts) (n/- |1 ups)) + (if (n/< (list/size parts) (n/- 1 ups)) (let [prefix (|> parts list/reverse - (list/drop (n/- |1 ups)) + (list/drop (n/- 1 ups)) list/reverse (interpose "/") text/join) clean (|> module (clip1 ups) (default (error! "UNDEFINED"))) output (case ("lux text size" clean) - |0 prefix + 0 prefix _ ($_ text/compose prefix "/" clean))] (return output)) (fail ($_ text/compose @@ -4545,7 +4545,7 @@ (n/odd? num) \"odd\" ## else-branch \"???\")"} - (if (n/= |0 (n/% |2 (list/size tokens))) + (if (n/= 0 (n/% 2 (list/size tokens))) (fail "cond requires an uneven number of arguments.") (case (list/reverse tokens) (^ (list& else branches')) @@ -4563,14 +4563,14 @@ (All [a] (-> Nat (List a) (List [Nat a]))) (case xs (#Cons x xs') - (#Cons [idx x] (enumerate' (n/+ |1 idx) xs')) + (#Cons [idx x] (enumerate' (n/+ 1 idx) xs')) #Nil #Nil)) (def: (enumerate xs) (All [a] (-> (List a) (List [Nat a]))) - (enumerate' |0 xs)) + (enumerate' 0 xs)) (macro: #export (get@ tokens) {#.doc "## Accesses the value of a record at a given tag. @@ -5176,7 +5176,7 @@ [(def: #export <name> {#.doc <doc>} (All [s] (-> (I64 s) (I64 s))) - (|>> (<special> |1)))] + (|>> (<special> 1)))] [inc "lux i64 +" "Increment function."] [dec "lux i64 -" "Decrement function."] @@ -5715,7 +5715,7 @@ (-> <type> Bit) (not (<even> n)))] - [Nat n/even? n/odd? n/% n/= |0 |2] + [Nat n/even? n/odd? n/% n/= 0 2] [Int i/even? i/odd? i/% i/= +0 +2]) (def: (get-scope-type-vars state) @@ -5735,17 +5735,17 @@ #None (#Cons x xs') - (if (n/= |0 idx) + (if (n/= 0 idx) (#Some x) (list-at (dec idx) xs')))) (macro: #export ($ tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." - "In the example below, |0 corresponds to the 'a' variable." + "In the example below, 0 corresponds to the 'a' variable." (def: #export (from-list list) (All [a] (-> (List a) (Row a))) (list/fold add - (: (Row ($ |0)) + (: (Row ($ 0)) empty) list)))} (case tokens @@ -5777,7 +5777,7 @@ {#.doc (doc "Allows you to simultaneously bind and de-structure a value." (def: (hash (^@ set [Hash<a> _])) (list/fold (function (_ elem acc) (n/+ (:: Hash<a> hash elem) acc)) - |0 + 0 (to-list set))))} (case tokens (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches)) @@ -5792,7 +5792,7 @@ (macro: #export (^|> tokens) {#.doc (doc "Pipes the value being pattern-matched against prior to binding it to a variable." (case input - (^|> value [inc (n/% |10) (n/max |1)]) + (^|> value [inc (n/% 10) (n/max 1)]) (foo value)))} (case tokens (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] [_ (#Tuple steps)]))] body branches)) @@ -5947,8 +5947,8 @@ (macro: #export (char tokens compiler) (case tokens (^multi (^ (list [_ (#Text input)])) - (n/= |1 ("lux text size" input))) - (|> ("lux text char" input |0) + (n/= 1 ("lux text size" input))) + (|> ("lux text char" input 0) (default (undefined)) nat$ list [compiler] #Right) @@ -6170,7 +6170,7 @@ (def: to-significand (-> (I64 Any) Frac) - (|>> ("lux i64 logical-right-shift" |11) + (|>> ("lux i64 logical-right-shift" 11) int-to-frac)) (def: rev-denominator Frac (to-significand -1)) @@ -6184,7 +6184,7 @@ (f/% +1.0) (f/* rev-denominator) frac-to-int - ("lux i64 left-shift" |11)))) + ("lux i64 left-shift" 11)))) (def: #export rev-to-frac (-> Rev Frac) diff --git a/stdlib/source/lux/compiler/default/cache.lux b/stdlib/source/lux/compiler/default/cache.lux index 1e264ec08..1770b4a82 100644 --- a/stdlib/source/lux/compiler/default/cache.lux +++ b/stdlib/source/lux/compiler/default/cache.lux @@ -18,7 +18,7 @@ (Format Module) ($_ _.and ## #module-hash - (_.ignore |0) + (_.ignore 0) ## #module-aliases (_.list ..alias) ## #definitions diff --git a/stdlib/source/lux/compiler/default/init.lux b/stdlib/source/lux/compiler/default/init.lux index 4972e75c5..af31e03a4 100644 --- a/stdlib/source/lux/compiler/default/init.lux +++ b/stdlib/source/lux/compiler/default/init.lux @@ -6,20 +6,20 @@ (def: #export (cursor file) (-> Text Cursor) - [file |1 |0]) + [file 1 0]) (def: #export (source file code) (-> Text Text Source) - [(cursor file) |0 code]) + [(cursor file) 0 code]) (def: dummy-source Source - [.dummy-cursor |0 ""]) + [.dummy-cursor 0 ""]) (def: #export type-context Type-Context - {#.ex-counter |0 - #.var-counter |0 + {#.ex-counter 0 + #.var-counter 0 #.var-bindings (list)}) (`` (def: #export info @@ -46,7 +46,7 @@ #.scopes (list) #.type-context ..type-context #.expected #.None - #.seed |0 + #.seed 0 #.scope-type-vars (list) #.extensions [] #.host host}) diff --git a/stdlib/source/lux/compiler/default/name.lux b/stdlib/source/lux/compiler/default/name.lux index 34bcf41eb..ddbf9ee8f 100644 --- a/stdlib/source/lux/compiler/default/name.lux +++ b/stdlib/source/lux/compiler/default/name.lux @@ -36,7 +36,7 @@ (def: #export (normalize name) (-> Text Text) (let [name/size (text.size name)] - (loop [idx |0 + (loop [idx 0 output ""] (if (n/< name/size idx) (recur (inc idx) diff --git a/stdlib/source/lux/compiler/default/phase/analysis.lux b/stdlib/source/lux/compiler/default/phase/analysis.lux index ff540cded..cbd447d46 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis.lux @@ -107,7 +107,7 @@ (n/= (dec size) tag)) (template: #export (no-op value) - (|> |1 #reference.Local #reference.Variable #..Reference + (|> 1 #reference.Local #reference.Variable #..Reference (#..Function (list)) (#..Apply value))) @@ -117,11 +117,11 @@ (let [left (function.constant (|>> #.Left #Sum <structure>)) right (|>> #.Right #Sum <structure>)] (if (last? size tag) - (if (n/= |1 tag) + (if (n/= 1 tag) (right value) (list/fold left (right value) - (list.n/range |0 (n/- |2 tag)))) + (list.n/range 0 (n/- 2 tag)))) (list/fold left (case value (<structure> (#Sum _)) @@ -129,7 +129,7 @@ _ value) - (list.n/range |0 tag)))))] + (list.n/range 0 tag)))))] [sum-analysis Analysis #Structure no-op] [sum-pattern Pattern #Complex id] @@ -174,7 +174,7 @@ (do-template [<name> <type> <tag>] [(def: #export (<name> value) (-> <type> (Maybe (Variant <type>))) - (loop [lefts |0 + (loop [lefts 0 variantA value] (case variantA (<tag> (#Sum (#.Left valueA))) @@ -238,13 +238,13 @@ (def: fresh-bindings (All [k v] (Bindings k v)) - {#.counter |0 + {#.counter 0 #.mappings (list)}) (def: fresh-scope Scope {#.name (list) - #.inner |0 + #.inner 0 #.locals fresh-bindings #.captured fresh-bindings}) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux b/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux index 716c11bf1..df09bb0ec 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux @@ -19,11 +19,11 @@ (def: cases (-> (Maybe Nat) Nat) - (|>> (maybe.default |0))) + (|>> (maybe.default 0))) (def: (variant sum-side) (-> (Either Pattern Pattern) (Variant Pattern)) - (loop [lefts |0 + (loop [lefts 0 variantP sum-side] (case variantP (#.Left valueP) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/inference.lux b/stdlib/source/lux/compiler/default/phase/analysis/inference.lux index 1676c0cf7..c96d0457c 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/inference.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/inference.lux @@ -70,7 +70,7 @@ (^template [<tag>] (<tag> env quantified) (<tag> (list/map (replace parameter-idx replacement) env) - (replace (n/+ |2 parameter-idx) replacement quantified))) + (replace (n/+ 2 parameter-idx) replacement quantified))) ([#.UnivQ] [#.ExQ]) @@ -199,7 +199,7 @@ ## Turns a variant type into the kind of function type suitable for inference. (def: #export (variant tag expected-size inferT) (-> Nat Nat Type (Operation Type)) - (loop [depth |0 + (loop [depth 0 currentT inferT] (case currentT (#.Named name unnamedT) @@ -224,9 +224,9 @@ (n/< boundary tag))) (case (list.nth tag cases) (#.Some caseT) - (operation/wrap (if (n/= |0 depth) + (operation/wrap (if (n/= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n/* |2)) inferT)] + (let [replace' (replace (|> depth dec (n/* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT))))) @@ -238,9 +238,9 @@ (n/= boundary tag) (let [caseT (type.variant (list.drop boundary cases))] - (operation/wrap (if (n/= |0 depth) + (operation/wrap (if (n/= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n/* |2)) inferT)] + (let [replace' (replace (|> depth dec (n/* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT)))))) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/scope.lux b/stdlib/source/lux/compiler/default/phase/analysis/scope.lux index 6b6896674..2c34e7a44 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/scope.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/scope.lux @@ -43,7 +43,7 @@ (def: (captured name scope) (-> Text Scope (Maybe [Type Variable])) - (loop [idx |0 + (loop [idx 0 mappings (get@ [#.captured #.mappings] scope)] (case mappings #.Nil @@ -133,7 +133,7 @@ (do-template [<name> <val-type>] [(def: <name> (Bindings Text [Type <val-type>]) - {#.counter |0 + {#.counter 0 #.mappings (list)})] [init-locals Nat] @@ -143,7 +143,7 @@ (def: (scope parent-name child-name) (-> (List Text) Text Scope) {#.name (list& child-name parent-name) - #.inner |0 + #.inner 0 #.locals init-locals #.captured init-captured}) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/structure.lux b/stdlib/source/lux/compiler/default/phase/analysis/structure.lux index 29203290a..f894679ef 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/structure.lux @@ -312,7 +312,7 @@ _ (if (n/= size-ts size-record) (wrap []) (///.throw record-size-mismatch [size-ts size-record recordT record])) - #let [tuple-range (list.n/range |0 (dec size-ts)) + #let [tuple-range (list.n/range 0 (dec size-ts)) tag->idx (dict.from-list name.Hash<Name> (list.zip2 tag-set tuple-range))] idx->val (monad.fold @ (function (_ [key val] idx->val) diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux index d5ff4a085..d4e94a36f 100644 --- a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux @@ -82,7 +82,7 @@ (wrap (#analysis.Extension extension-name (list opA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: lux::in-module Handler @@ -108,7 +108,7 @@ ## (analyse valueC))) ## _ -## (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)]))))] +## (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)]))))] ## [lux::check (:coerce Type actualT)] ## [lux::coerce Any] @@ -126,7 +126,7 @@ (wrap valueA)) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: bundle::lux Bundle @@ -275,7 +275,7 @@ (wrap (#analysis.Extension extension-name (list initA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: atom::read Handler @@ -315,7 +315,7 @@ (wrap (#analysis.Extension extension-name (list initA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: box::read Handler diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux index 9e4cd2e7e..706d35e51 100644 --- a/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux @@ -231,7 +231,7 @@ (wrap (#analysis.Extension extension-name (list arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: array::new Handler @@ -244,7 +244,7 @@ expectedT (///.lift macro.expected-type) [level elem-class] (: (Operation [Nat Text]) (loop [analysisT expectedT - level |0] + level 0] (case analysisT (#.Apply inputT funcT) (case (type.apply (list inputT) funcT) @@ -262,7 +262,7 @@ _ (////.throw non-array expectedT)))) - _ (if (n/> |0 level) + _ (if (n/> 0 level) (wrap []) (////.throw non-array expectedT))] (wrap (#analysis.Extension extension-name (list (analysis.nat (dec level)) @@ -270,7 +270,7 @@ lengthA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: (check-jvm objectT) (-> Type (Operation Text)) @@ -344,7 +344,7 @@ (wrap (#analysis.Extension extension-name (list (analysis.text elem-class) idxA arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: array::write Handler @@ -366,7 +366,7 @@ (wrap (#analysis.Extension extension-name (list (analysis.text elem-class) idxA valueA arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: bundle::array Bundle @@ -389,7 +389,7 @@ (wrap (#analysis.Extension extension-name (list)))) _ - (////.throw bundle.incorrect-arity [extension-name |0 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 0 (list.size args)])))) (def: object::null? Handler @@ -404,7 +404,7 @@ (wrap (#analysis.Extension extension-name (list objectA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::synchronized Handler @@ -419,7 +419,7 @@ (wrap (#analysis.Extension extension-name (list monitorA exprA)))) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (host.import: java/lang/Object (equals [Object] boolean)) @@ -516,7 +516,7 @@ (wrap (#analysis.Extension extension-name (list exceptionA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::class Handler @@ -534,7 +534,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::instance? Handler @@ -557,7 +557,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: (java-type-to-class jvm-type) (-> java/lang/reflect/Type (Operation Text)) @@ -588,8 +588,8 @@ (host.instance? WildcardType java-type) (let [java-type (:coerce WildcardType java-type)] - (case [(array.read |0 (WildcardType::getUpperBounds [] java-type)) - (array.read |0 (WildcardType::getLowerBounds [] java-type))] + (case [(array.read 0 (WildcardType::getUpperBounds [] java-type)) + (array.read 0 (WildcardType::getLowerBounds [] java-type))] (^or [(#.Some bound) _] [_ (#.Some bound)]) (java-type-to-lux-type mappings bound) @@ -600,13 +600,13 @@ (let [java-type (:coerce (Class Object) java-type) class-name (Class::getName [] java-type)] (operation/wrap (case (array.size (Class::getTypeParameters [] java-type)) - |0 + 0 (#.Primitive class-name (list)) arity - (|> (list.n/range |0 (dec arity)) + (|> (list.n/range 0 (dec arity)) list.reverse - (list/map (|>> (n/* |2) inc #.Parameter)) + (list/map (|>> (n/* 2) inc #.Parameter)) (#.Primitive class-name) (type.univ-q arity))))) @@ -831,7 +831,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: static::put Handler @@ -853,7 +853,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: virtual::get Handler @@ -872,7 +872,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: virtual::put Handler @@ -896,7 +896,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |4 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 4 (list.size args)])))) (def: (java-type-to-parameter type) (-> java/lang/reflect/Type (Operation Text)) @@ -970,11 +970,11 @@ (def: idx-to-parameter (-> Nat Type) - (|>> (n/* |2) inc #.Parameter)) + (|>> (n/* 2) inc #.Parameter)) (def: (type-vars amount offset) (-> Nat Nat (List Type)) - (if (n/= |0 amount) + (if (n/= 0 amount) (list) (|> (list.n/range offset (|> amount dec (n/+ offset))) (list/map idx-to-parameter)))) @@ -998,7 +998,7 @@ num-method-tvars (list.size method-tvars) all-tvars (list/compose owner-tvars method-tvars) num-all-tvars (list.size all-tvars) - owner-tvarsT (type-vars num-owner-tvars |0) + owner-tvarsT (type-vars num-owner-tvars 0) method-tvarsT (type-vars num-method-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) @@ -1086,7 +1086,7 @@ num-owner-tvars (list.size owner-tvars) all-tvars (list/compose owner-tvars constructor-tvars) num-all-tvars (list.size all-tvars) - owner-tvarsT (type-vars num-owner-tvars |0) + owner-tvarsT (type-vars num-owner-tvars 0) constructor-tvarsT (type-vars num-all-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis.lux b/stdlib/source/lux/compiler/default/phase/synthesis.lux index 28392eafd..1dbbffd84 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis.lux @@ -25,10 +25,10 @@ (def: #export init State - {#scope-arity |0 + {#scope-arity 0 #resolver fresh-resolver #direct? #0 - #locals |0}) + #locals 0}) (type: #export Primitive (#Bit Bit) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux b/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux index 0ab38afac..241896e58 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux @@ -67,11 +67,11 @@ (do @ [arity //.scope-arity] (wrap (if (function.nested? arity) - (if (n/= |0 register) + (if (n/= 0 register) (|> (dec arity) - (list.n/range |1) + (list.n/range 1) (list/map (|>> //.variable/local)) - [(//.variable/local |0)] + [(//.variable/local 0)] //.function/apply) (#//.Reference (#reference.Variable (function.adjust arity #0 var)))) (#//.Reference (#reference.Variable var))))) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux index b7dd22f70..eadcd52b0 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux @@ -20,7 +20,7 @@ (def: #export nested? (-> Arity Bit) - (n/> |1)) + (n/> 1)) (def: #export (adjust up-arity after? var) (-> Arity Bit Variable Variable) @@ -90,7 +90,7 @@ resolver //.resolver #let [function-arity (if direct? (inc arity) - |1) + 1) up-environment (if (nested? arity) (list/map (.function (_ closure) (case (dict.get closure resolver) @@ -107,7 +107,7 @@ (list) _ - (|> (list.size environment) dec (list.n/range |0) + (|> (list.size environment) dec (list.n/range 0) (list/map (|>> #reference.Foreign))))) resolver' (if (and (nested? function-arity) direct?) @@ -129,6 +129,6 @@ ..return)) _ - (|> (prepare function-arity |1 bodyS) - (maybe/map (|>> [up-environment |1] //.function/abstraction)) + (|> (prepare function-arity 1 bodyS) + (maybe/map (|>> [up-environment 1] //.function/abstraction)) ..return)))) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux b/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux index 4bae596c3..e7db982d8 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux @@ -27,7 +27,7 @@ #.None #0)) (template: #export (self) - (#//.Reference (reference.local |0))) + (#//.Reference (reference.local 0))) (template: (recursive-apply args) (#//.Apply (self) args)) diff --git a/stdlib/source/lux/compiler/default/phase/translation.lux b/stdlib/source/lux/compiler/default/phase/translation.lux index ec67565d6..f9d61c4af 100644 --- a/stdlib/source/lux/compiler/default/phase/translation.lux +++ b/stdlib/source/lux/compiler/default/phase/translation.lux @@ -76,12 +76,12 @@ (-> (Host expression statement) (..State anchor expression statement))) {#context {#scope-name "" - #inner-functions |0} + #inner-functions 0} #anchor #.None #host host #buffer #.None #artifacts (dict.new text.Hash<Text>) - #counter |0}) + #counter 0}) (def: #export (with-context expr) (All [anchor expression statement output] @@ -90,7 +90,7 @@ (function (_ [bundle state]) (let [[old-scope old-inner] (get@ #context state) new-scope (format old-scope "c___" (%i (.int old-inner)))] - (case (expr [bundle (set@ #context [new-scope |0] state)]) + (case (expr [bundle (set@ #context [new-scope 0] state)]) (#error.Success [[bundle' state'] output]) (#error.Success [[bundle' (set@ #context [old-scope (inc old-inner)] state')] [new-scope output]]) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux index b1dce6688..9952a754d 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux @@ -30,10 +30,10 @@ (syntax: (Vector {size s.nat} elemT) (wrap (list (` [(~+ (list.repeat size elemT))])))) -(type: #export Nullary (-> (Vector |0 Expression) Computation)) -(type: #export Unary (-> (Vector |1 Expression) Computation)) -(type: #export Binary (-> (Vector |2 Expression) Computation)) -(type: #export Trinary (-> (Vector |3 Expression) Computation)) +(type: #export Nullary (-> (Vector 0 Expression) Computation)) +(type: #export Unary (-> (Vector 1 Expression) Computation)) +(type: #export Binary (-> (Vector 2 Expression) Computation)) +(type: #export Trinary (-> (Vector 3 Expression) Computation)) (type: #export Variadic (-> (List Expression) Computation)) ## [Utils] @@ -55,12 +55,12 @@ ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) (~' _) - (/////.throw bundle.incorrect-arity [(~ g!name) |1 (list.size (~ g!inputs))])))))))))) + (/////.throw bundle.incorrect-arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) -(arity: nullary |0) -(arity: unary |1) -(arity: binary |2) -(arity: trinary |3) +(arity: nullary 0) +(arity: unary 1) +(arity: binary 2) +(arity: trinary 3) (def: #export (variadic extension) (-> Variadic Handler) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux index bf65a7606..d4316a0b5 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux @@ -70,8 +70,8 @@ (_.letrec (list [@function (_.lambda [(list) (#.Some @curried)] (_.let (list [@num-args (_.length/1 @curried)]) (<| (_.if (|> @num-args (_.=/2 arityO)) - (<| (_.let (list [(reference.local' |0) @function])) - (_.let-values (list [[(|> (list.n/range |0 (dec arity)) + (<| (_.let (list [(reference.local' 0) @function])) + (_.let-values (list [[(|> (list.n/range 0 (dec arity)) (list/map ..input)) #.None] (_.apply/2 (_.global "apply") (_.global "values") @curried)])) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux index d72312693..2ec83227d 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux @@ -58,19 +58,19 @@ (def: #export none Computation - (variant [|0 #0 ..unit])) + (variant [0 #0 ..unit])) (def: #export some (-> Expression Computation) - (|>> [|0 #1] ..variant)) + (|>> [0 #1] ..variant)) (def: #export left (-> Expression Computation) - (|>> [|0 #0] ..variant)) + (|>> [0 #0] ..variant)) (def: #export right (-> Expression Computation) - (|>> [|0 #1] ..variant)) + (|>> [0 #1] ..variant)) (def: declaration (s.Syntax [Text (List Text)]) diff --git a/stdlib/source/lux/compiler/default/reference.lux b/stdlib/source/lux/compiler/default/reference.lux index 1c94c0349..0bbeb2db5 100644 --- a/stdlib/source/lux/compiler/default/reference.lux +++ b/stdlib/source/lux/compiler/default/reference.lux @@ -31,10 +31,10 @@ (def: (hash var) (case var (#Local register) - (n/* |1 register) + (n/* 1 register) (#Foreign register) - (n/* |2 register)))) + (n/* 2 register)))) (do-template [<name> <family> <tag>] [(template: #export (<name> content) @@ -55,12 +55,12 @@ [constant #..Constant] ) -(def: #export self Reference (..local |0)) +(def: #export self Reference (..local 0)) (def: #export self? (-> Variable Bit) (|>> ..variable - (case> (^ (..local |0)) + (case> (^ (..local 0)) #1 _ diff --git a/stdlib/source/lux/compiler/default/repl/type.lux b/stdlib/source/lux/compiler/default/repl/type.lux index e6d25a76a..212c5bcb9 100644 --- a/stdlib/source/lux/compiler/default/repl/type.lux +++ b/stdlib/source/lux/compiler/default/repl/type.lux @@ -110,7 +110,7 @@ (n/= num-tags (list.size casesR+)))] (wrap (function (_ variantV) (loop [cases-left (list.zip3 tags - (list.n/range |0 (dec num-tags)) + (list.n/range 0 (dec num-tags)) casesR+) variantV variantV] (case cases-left diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux index f88cedc9b..0497f55a2 100644 --- a/stdlib/source/lux/compiler/default/syntax.lux +++ b/stdlib/source/lux/compiler/default/syntax.lux @@ -64,7 +64,7 @@ [content (l.many (l.one-of new-line))] (wrap [(|> where (update@ #.line (n/+ (text.size content))) - (set@ #.column |0)) + (set@ #.column 0)) content])) )) @@ -78,7 +78,7 @@ _ (l.this new-line)] (wrap [(|> where (update@ #.line inc) - (set@ #.column |0)) + (set@ #.column 0)) comment]))) ## This is just a helper parser to find text which doesn't run into @@ -100,7 +100,7 @@ (do p.Monad<Parser> [_ (l.this "#(")] (loop [comment "" - where (update@ #.column (n/+ |2) where)] + where (update@ #.column (n/+ 2) where)] ($_ p.either ## These are normal chunks of commented text. (do @ @@ -115,7 +115,7 @@ (recur (format comment new-line) (|> where (update@ #.line inc) - (set@ #.column |0)))) + (set@ #.column 0)))) ## This is the rule for handling nested sub-comments. ## Ultimately, the whole comment is just treated as text ## (the comment must respect the syntax structure, but the @@ -129,7 +129,7 @@ ## Finally, this is the rule for closing the comment. (do @ [_ (l.this ")#")] - (wrap [(update@ #.column (n/+ |2) where) + (wrap [(update@ #.column (n/+ 2) where) comment])) )))) @@ -171,22 +171,22 @@ [code l.any] (case code ## Handle special cases. - "t" (wrap [|2 "\t"]) - "v" (wrap [|2 "\v"]) - "b" (wrap [|2 "\b"]) - "n" (wrap [|2 "\n"]) - "r" (wrap [|2 "\r"]) - "f" (wrap [|2 "\f"]) - "\"" (wrap [|2 "\""]) - "\\" (wrap [|2 "\\"]) + "t" (wrap [2 "\t"]) + "v" (wrap [2 "\v"]) + "b" (wrap [2 "\b"]) + "n" (wrap [2 "\n"]) + "r" (wrap [2 "\r"]) + "f" (wrap [2 "\f"]) + "\"" (wrap [2 "\""]) + "\\" (wrap [2 "\\"]) ## Handle unicode escapes. "u" (do p.Monad<Parser> - [code (l.between |1 |4 l.hexadecimal)] + [code (l.between 1 4 l.hexadecimal)] (wrap (case (|> code (format "+") (:: number.Hex@Codec<Text,Nat> decode)) (#.Right value) - [(n/+ |2 (text.size code)) (text.from-code value)] + [(n/+ 2 (text.size code)) (text.from-code value)] _ (undefined)))) @@ -251,7 +251,7 @@ (update@ #.column (n/+ chars-consumed))) char])))) _ (l.this "\"") - #let [char (maybe.assume (text.nth |0 char))]] + #let [char (maybe.assume (text.nth 0 char))]] (wrap [(|> where' (update@ #.column inc)) [where (#.Nat char)]]))) @@ -412,7 +412,7 @@ (recur (format text-read new-line) (|> where (update@ #.line inc) - (set@ #.column |0)) + (set@ #.column 0)) #1)))))] (wrap [where' [where (#.Text text-read)]]))) @@ -529,7 +529,7 @@ [_ (l.this current-module-mark) def-name name-part^] (wrap [[current-module def-name] - (n/+ |2 (text.size def-name))])) + (n/+ 2 (text.size def-name))])) ## If the name is prefixed by the mark, but no module ## part, the module is assumed to be "lux" (otherwise known as ## the 'prelude'). @@ -559,7 +559,7 @@ second-part] ($_ n/+ (text.size first-part) - |1 + 1 (text.size second-part))])) (wrap [["" first-part] (text.size first-part)]))))) @@ -569,7 +569,7 @@ (do p.Monad<Parser> [[value length] (p.after (l.this "#") (name^ current-module aliases))] - (wrap [(update@ #.column (|>> ($_ n/+ |1 length)) where) + (wrap [(update@ #.column (|>> ($_ n/+ 1 length)) where) [where (#.Tag value)]]))) (def: #export (identifier current-module aliases where) diff --git a/stdlib/source/lux/compiler/meta/io/archive.lux b/stdlib/source/lux/compiler/meta/io/archive.lux index 27c7416f0..1f0714b25 100644 --- a/stdlib/source/lux/compiler/meta/io/archive.lux +++ b/stdlib/source/lux/compiler/meta/io/archive.lux @@ -67,7 +67,7 @@ (#.Some ["" post]) (let [raw (text.replace-all (:: System<m> separator) "/" post)] (if (text.starts-with? "/" raw) - (text.clip' |1 raw) + (text.clip' 1 raw) (#.Some raw))) _ diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index da76351c4..f6a6fbe0d 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -335,11 +335,11 @@ (if (list.empty? actor-vars) (list) (|> actor-vars list.size dec - (list.n/range |0) (list/map (|>> code.nat (~) ($) (`)))))) + (list.n/range 0) (list/map (|>> code.nat (~) ($) (`)))))) ref-replacements (|> (if (list.empty? actor-vars) (list) (|> actor-vars list.size dec - (list.n/range |0) (list/map (|>> code.nat (~) ($) (`))))) + (list.n/range 0) (list/map (|>> code.nat (~) ($) (`))))) (: (List Code)) (list.zip2 g!all-vars) (: (List [Code Code]))) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 6e2450068..7062c2082 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -155,7 +155,7 @@ (def: #export future {#.doc "Runs an I/O computation on its own process and returns a Promise that will eventually host its result."} (All [a] (-> (IO a) (Promise a))) - (schedule |0)) + (schedule 0)) (def: #export (delay time-millis value) {#.doc "Delivers a value after a certain period has passed."} diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index 5b1688048..7b749ea60 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -33,8 +33,8 @@ [state (atom.read semaphore) #let [[ready? state'] (: [Bit State] (case (get@ #open-positions state) - |0 [#0 (update@ #waiting-list (|>> (#.Cons signal)) - state)] + 0 [#0 (update@ #waiting-list (|>> (#.Cons signal)) + state)] _ [#1 (update@ #open-positions dec state)]))] success? (atom.compare-and-swap state state' semaphore) @@ -79,7 +79,7 @@ (def: #export (mutex _) (-> Any Mutex) - (:abstraction (semaphore |1))) + (:abstraction (semaphore 1))) (def: (acquire mutex) (-> Mutex (Promise Any)) @@ -98,7 +98,7 @@ (wrap output))) ) -(def: #export limit (refinement.refinement (n/> |0))) +(def: #export limit (refinement.refinement (n/> 0))) (`` (type: #export Limit (~~ (refinement.type limit)))) (abstract: #export Barrier @@ -112,13 +112,13 @@ (def: #export (barrier limit) (-> Limit Barrier) (:abstraction {#limit limit - #count (atom.atom |0) - #start-turnstile (semaphore |0) - #end-turnstile (semaphore |0)})) + #count (atom.atom 0) + #start-turnstile (semaphore 0) + #end-turnstile (semaphore 0)})) (def: (un-block times turnstile) (-> Nat Semaphore (Promise Any)) - (loop [step |0] + (loop [step 0] (if (n/< times step) (do promise.Monad<Promise> [_ (signal turnstile)] @@ -138,7 +138,7 @@ (wait (get@ <turnstile> barrier))))] [start inc limit #start-turnstile] - [end dec |0 #end-turnstile] + [end dec 0 #end-turnstile] ) (def: #export (block barrier) diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 7efe24942..23a059ae4 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -26,7 +26,7 @@ [a (F (CoFree F a))]) ## [Syntax] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) (macro: #export (be tokens state) {#.doc (doc "A co-monadic parallel to the \"do\" macro." @@ -36,7 +36,7 @@ (square (head inputs)))))} (case tokens (#.Cons comonad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) - (if (|> bindings list.size (n/% |2) (n/= |0)) + (if (|> bindings list.size (n/% 2) (n/= 0)) (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) g!map (: Code [_cursor (#.Identifier ["" " map "])]) g!split (: Code [_cursor (#.Identifier ["" " split "])]) diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index 47c3ea4ca..0011c8956 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -129,7 +129,7 @@ (~ type) (|>> (~+ (list/map prepare commands)))))))) -(syntax: #export (apply {arity (|> s.nat (p.filter (.n/> |0)))}) +(syntax: #export (apply {arity (|> s.nat (p.filter (.n/> 0)))}) (with-gensyms [g! g!func g!stack g!output] (monad.do @ [g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq @))] @@ -141,14 +141,14 @@ [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) ## [Primitives] -(def: #export apply1 (apply |1)) -(def: #export apply2 (apply |2)) -(def: #export apply3 (apply |3)) -(def: #export apply4 (apply |4)) -(def: #export apply5 (apply |5)) -(def: #export apply6 (apply |6)) -(def: #export apply7 (apply |7)) -(def: #export apply8 (apply |8)) +(def: #export apply1 (apply 1)) +(def: #export apply2 (apply 2)) +(def: #export apply3 (apply 3)) +(def: #export apply4 (apply 4)) +(def: #export apply5 (apply 5)) +(def: #export apply6 (apply 6)) +(def: #export apply7 (apply 7)) +(def: #export apply8 (apply 8)) (def: #export (push x) (All [a] (-> a (=> [] [a]))) @@ -193,12 +193,12 @@ (def: #export ||L (All [a b] (=> [a] [(| a b)])) (function (_ [stack l]) - [stack (|0 l)])) + [stack (0 l)])) (def: #export ||R (All [a b] (=> [b] [(| a b)])) (function (_ [stack r]) - [stack (|1 r)])) + [stack (1 r)])) (do-template [<input> <output> <word> <func>] [(def: #export <word> diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux index 5f9ca37b6..c10b0c295 100644 --- a/stdlib/source/lux/control/equivalence.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -15,10 +15,10 @@ (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) (structure (def: (= a|b x|y) (case [a|b x|y] - [(|0 a) (|0 x)] + [(0 a) (0 x)] (:: left = a x) - [(|1 b) (|1 y)] + [(1 b) (1 y)] (:: right = b y) _ diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index 66c7ebf7b..d2e9c705d 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -116,7 +116,7 @@ (-> (List [Text Text]) Text) (let [largest-header-size (|> entries (list/map (|>> product.left text.size)) - (list/fold n/max |0))] + (list/fold n/max 0))] (|> entries (list/map (function (_ [header message]) (let [padding (|> " " diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index e3196faf5..36b2354fc 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -16,7 +16,7 @@ (def: (list/size xs) (All [a] (-> (List a) Nat)) - (loop [counter |0 + (loop [counter 0 xs xs] (case xs #.Nil @@ -53,7 +53,7 @@ join)) ## [Syntax] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) (macro: #export (do tokens state) {#.doc (doc "Macro for easy concatenation of monadic operations." @@ -63,7 +63,7 @@ (wrap (f3 z))))} (case tokens (#.Cons monad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) - (if (|> bindings list/size (n/% |2) (n/= |0)) + (if (|> bindings list/size (n/% 2) (n/= 0)) (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) g!map (: Code [_cursor (#.Identifier ["" " map "])]) g!join (: Code [_cursor (#.Identifier ["" " join "])]) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 48119eaa5..c40de3373 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -119,11 +119,11 @@ (-> (Parser s a) (Parser s b) (Parser s (| a b)))) (function (_ tokens) (case (p1 tokens) - (#e.Success [tokens' x1]) (#e.Success [tokens' (|0 x1)]) + (#e.Success [tokens' x1]) (#e.Success [tokens' (0 x1)]) (#e.Error _) (run tokens (do Monad<Parser> [x2 p2] - (wrap (|1 x2)))) + (wrap (1 x2)))) ))) (def: #export (either pl pr) @@ -139,7 +139,7 @@ (def: #export (exactly n p) {#.doc "Parse exactly N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) - (if (n/> |0 n) + (if (n/> 0 n) (do Monad<Parser> [x p xs (exactly (dec n) p)] @@ -157,7 +157,7 @@ (def: #export (at-most n p) {#.doc "Parse at most N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) - (if (n/> |0 n) + (if (n/> 0 n) (function (_ input) (case (p input) (#e.Error msg) diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux index a9a97b0c9..c23723f6d 100644 --- a/stdlib/source/lux/control/pipe.lux +++ b/stdlib/source/lux/control/pipe.lux @@ -16,7 +16,7 @@ (Syntax (List Code)) (s.tuple (p.some s.any))) -(syntax: #export (new> {tokens (p.at-least |2 s.any)}) +(syntax: #export (new> {tokens (p.at-least 2 s.any)}) {#.doc (doc "Ignores the piped argument, and begins a new pipe." (|> +20 (i/* +3) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index fc964537c..4007cb6cb 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -60,7 +60,7 @@ (def: (join MlMla) (do Monad<M> [## TODO: Remove once new-luxc is the standard compiler. - [l1 Mla] (: (($ |1) (Writer ($ |0) (($ |1) (Writer ($ |0) ($ |2))))) + [l1 Mla] (: (($ 1) (Writer ($ 0) (($ 1) (Writer ($ 0) ($ 2))))) MlMla) ## [l1 Mla] MlMla [l2 a] Mla] diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index 8b61d8b32..026f8bcab 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 - #1 |1 - #0 |0))) + #1 1 + #0 0))) (do-template [<name> <identity> <op>] [(structure: #export <name> (Monoid Bit) diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 588c5132b..1d64511a9 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -38,7 +38,7 @@ (All [a] (-> Nat Nat (Array a) Nat (Array a) (Array a))) - (if (n/= |0 length) + (if (n/= 0 length) dest-array (list/fold (function (_ offset target) (case (read (n/+ offset src-start) src-array) @@ -48,7 +48,7 @@ (#.Some value) (write (n/+ offset dest-start) value target))) dest-array - (list.n/range |0 (dec length))))) + (list.n/range 0 (dec length))))) (def: #export (occupied array) {#.doc "Finds out how many cells in an array are occupied."} @@ -60,7 +60,7 @@ (#.Some _) (inc count))) - |0 + 0 (list.indices (size array)))) (def: #export (vacant array) @@ -87,7 +87,7 @@ (All [a] (-> (-> a Bit) (Array a) (Maybe a))) (let [arr-size (size xs)] - (loop [idx |0] + (loop [idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -104,7 +104,7 @@ (All [a] (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) (let [arr-size (size xs)] - (loop [idx |0] + (loop [idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -133,10 +133,10 @@ (All [a] (-> (List a) (Array a))) (product.right (list/fold (function (_ x [idx arr]) [(inc idx) (write idx x arr)]) - [|0 (new (list.size xs))] + [0 (new (list.size xs))] xs))) -(def: underflow Nat (dec |0)) +(def: underflow Nat (dec 0)) (def: #export (to-list array) (All [a] (-> (Array a) (List a))) @@ -170,23 +170,23 @@ _ #0))) #1 - (list.n/range |0 (dec sxs))))) + (list.n/range 0 (dec sxs))))) )) (structure: #export Monoid<Array> (All [a] (Monoid (Array a))) - (def: identity (new |0)) + (def: identity (new 0)) (def: (compose xs ys) (let [sxs (size xs) sxy (size ys)] (|> (new (n/+ sxy sxs)) - (copy sxs |0 xs |0) - (copy sxy |0 ys sxs))))) + (copy sxs 0 xs 0) + (copy sxy 0 ys sxs))))) (structure: #export _ (Functor Array) (def: (map f ma) (let [arr-size (size ma)] - (if (n/= |0 arr-size) + (if (n/= 0 arr-size) (new arr-size) (list/fold (function (_ idx mb) (case (read idx ma) @@ -196,14 +196,14 @@ (#.Some x) (write idx (f x) mb))) (new arr-size) - (list.n/range |0 (dec arr-size))) + (list.n/range 0 (dec arr-size))) )))) (structure: #export _ (Fold Array) (def: (fold f init xs) (let [arr-size (size xs)] (loop [so-far init - idx |0] + idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -218,7 +218,7 @@ (All [a] (-> (Predicate a) (Array a) Bit)) (let [size (..size array)] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (case (..read idx array) (#.Some value) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 5caec8eb7..66cb2dab7 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -19,17 +19,17 @@ (type: #export Bits (Array Chunk)) -(def: empty-chunk Chunk (.i64 |0)) +(def: empty-chunk Chunk (.i64 0)) (def: #export empty Bits - (array.new |0)) + (array.new 0)) (def: #export (size bits) (-> Bits Nat) (array/fold (function (_ chunk total) (|> chunk i64.count (n/+ total))) - |0 + 0 bits)) (def: #export (capacity bits) @@ -38,7 +38,7 @@ (def: #export empty? (-> Bits Bit) - (|>> size (n/= |0))) + (|>> size (n/= 0))) (def: #export (get index bits) (-> Nat Bits Bit) @@ -62,7 +62,7 @@ (array.size input)) output ..empty] (let [idx|output (dec size|output)] - (if (n/> |0 size|output) + (if (n/> 0 size|output) (case (|> (..chunk idx|output input) (cond> [(new> (n/= chunk-index idx|output))] [(<op> bit-index)] @@ -70,7 +70,7 @@ ## else []) .nat) - |0 + 0 ## TODO: Remove 'no-op' once new-luxc is the official compiler. (let [no-op (recur (dec size|output) output)] no-op) @@ -92,7 +92,7 @@ (-> Bits Bits Bit) (let [chunks (n/min (array.size reference) (array.size sample))] - (loop [idx |0] + (loop [idx 0] (if (n/< chunks idx) (.or (|> (..chunk idx sample) (i64.and (..chunk idx reference)) @@ -104,7 +104,7 @@ (def: #export (not input) (-> Bits Bits) (case (array.size input) - |0 + 0 ..empty size|output @@ -112,11 +112,11 @@ output ..empty] (let [idx (dec size|output)] (case (|> input (..chunk idx) i64.not .nat) - |0 + 0 (recur (dec size|output) output) chunk - (if (n/> |0 size|output) + (if (n/> 0 size|output) (|> (if (is? ..empty output) (: Bits (array.new size|output)) output) @@ -129,18 +129,18 @@ (-> Bits Bits Bits) (case (n/max (array.size param) (array.size subject)) - |0 + 0 ..empty size|output (loop [size|output size|output output ..empty] (let [idx (dec size|output)] - (if (n/> |0 size|output) + (if (n/> 0 size|output) (case (|> (..chunk idx subject) (<op> (..chunk idx param)) .nat) - |0 + 0 (recur (dec size|output) output) chunk @@ -160,7 +160,7 @@ (def: (= reference sample) (let [size (n/max (array.size reference) (array.size sample))] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (.and ("lux i64 =" (..chunk idx reference) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 64c577946..3d4e84207 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -41,7 +41,7 @@ ## the appropriate multiple of the branching-exponent. ## A shift of 0 means root level. ## A shift of (* branching-exponent 1) means level 2. -## A shift of (* branching-exponent N) means level N|1. +## A shift of (* branching-exponent N) means level N+1. (type: Level Nat) ## Nodes for the tree data-structure that organizes the data inside @@ -75,7 +75,7 @@ ## Which is 32 zeroes, since the branching factor is 32. (def: clean-bitmap BitMap - |0) + 0) ## Bitmap position (while looking inside #Base nodes) is determined by ## getting 5 bits from a hash of the key being looked up and using @@ -88,35 +88,35 @@ ## shift in the shallowest node on the tree, which is the root node). (def: root-level Level - |0) + 0) ## The exponent to which 2 must be elevated, to reach the branching ## factor of the data-structure. (def: branching-exponent Nat - |5) + 5) ## The threshold on which #Hierarchy nodes are demoted to #Base nodes, ## which is 1/4 of the branching factor (or a left-shift 2). (def: demotion-threshold Nat - (i64.left-shift (n/- |2 branching-exponent) |1)) + (i64.left-shift (n/- 2 branching-exponent) 1)) ## The threshold on which #Base nodes are promoted to #Hierarchy nodes, ## which is 1/2 of the branching factor (or a left-shift 1). (def: promotion-threshold Nat - (i64.left-shift (n/- |1 branching-exponent) |1)) + (i64.left-shift (n/- 1 branching-exponent) 1)) ## The size of hierarchy-nodes, which is 2^(branching-exponent). (def: hierarchy-nodes-size Nat - (i64.left-shift branching-exponent |1)) + (i64.left-shift branching-exponent 1)) ## The cannonical empty node, which is just an empty #Base node. (def: empty Node - (#Base clean-bitmap (array.new |0))) + (#Base clean-bitmap (array.new 0))) ## Expands a copy of the array, to have 1 extra slot, which is used ## for storing the value. @@ -124,7 +124,7 @@ (All [a] (-> Index a (Array a) (Array a))) (let [old-size (array.size old-array)] (|> (array.new (inc old-size)) - (array.copy idx |0 old-array |0) + (array.copy idx 0 old-array 0) (array.write idx value) (array.copy (n/- idx old-size) idx old-array (inc idx))))) @@ -143,13 +143,13 @@ (All [a] (-> Index (Array a) (Array a))) (let [new-size (dec (array.size array))] (|> (array.new new-size) - (array.copy idx |0 array |0) + (array.copy idx 0 array 0) (array.copy (n/- idx new-size) (inc idx) array idx)))) ## Given a top-limit for indices, produces all indices in [0, R). (def: indices-for (-> Nat (List Index)) - (|>> dec (list.n/range |0))) + (|>> dec (list.n/range 0))) ## Increases the level-shift by the branching-exponent, to explore ## levels further down the tree. @@ -169,7 +169,7 @@ ## A mechanism to go from indices to bit-positions. (def: (->bit-position index) (-> Index BitPosition) - (i64.left-shift index |1)) + (i64.left-shift index 1)) ## The bit-position within a base that a given hash-code would have. (def: (bit-position level hash) @@ -234,8 +234,8 @@ [(set-bit-position (->bit-position idx) bitmap) (array.write insertion-idx (#.Left sub-node) base)]]) ))) - [|0 [clean-bitmap - (array.new (dec h-size))]] + [0 [clean-bitmap + (array.new (dec h-size))]] (list.indices (array.size h-array))))) ## When #Base nodes grow too large, they're promoted to #Hierarchy to @@ -264,7 +264,7 @@ #.None (undefined))] default)) - [|0 + [0 (array.new hierarchy-nodes-size)] hierarchy-indices))) @@ -326,9 +326,9 @@ ## the same, a new ## #Collisions node ## is added. - (#Collisions hash (|> (array.new |2) - (array.write |0 [key' val']) - (array.write |1 [key val]))) + (#Collisions hash (|> (array.new 2) + (array.write 0 [key' val']) + (array.write 1 [key val]))) ## Otherwise, I can ## just keep using ## #Base nodes, so I @@ -371,8 +371,8 @@ ## If the hashes are not equal, I create a new #Base node that ## contains the old #Collisions node, plus the new KV-pair. (|> (#Base (bit-position level _hash) - (|> (array.new |1) - (array.write |0 (#.Left node)))) + (|> (array.new 1) + (array.write 0 (#.Left node)))) (put' level hash key val Hash<k>))) )) @@ -460,7 +460,7 @@ ## But if so, then check the size of the collisions list. (#.Some idx) - (if (n/= |1 (array.size _colls)) + (if (n/= 1 (array.size _colls)) ## If there's only one left, then removing it leaves us with ## an empty node. empty @@ -505,14 +505,14 @@ (All [k v] (-> (Node k v) Nat)) (case node (#Hierarchy _size hierarchy) - (array/fold n/+ |0 (array/map size' hierarchy)) + (array/fold n/+ 0 (array/map size' hierarchy)) (#Base _ base) - (array/fold n/+ |0 (array/map (function (_ sub-node') - (case sub-node' - (#.Left sub-node) (size' sub-node) - (#.Right _) |1)) - base)) + (array/fold n/+ 0 (array/map (function (_ sub-node') + (case sub-node' + (#.Left sub-node) (size' sub-node) + (#.Right _) 1)) + base)) (#Collisions hash colls) (array.size colls) @@ -605,7 +605,7 @@ (def: #export empty? (All [k v] (-> (Dictionary k v) Bit)) - (|>> size (n/= |0))) + (|>> size (n/= 0))) (def: #export (entries dict) (All [k v] (-> (Dictionary k v) (List [k v]))) diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 38442f93d..25c50367b 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -115,7 +115,7 @@ (loop [node (get@ #root dict)] (case node #.None - |0 + 0 (#.Some node) (inc (<op> (recur (get@ #left node)) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index d7a2145c6..09328def9 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -68,7 +68,7 @@ [(def: #export (<name> n xs) (All [a] (-> Nat (List a) (List a))) - (if (n/> |0 n) + (if (n/> 0 n) (case xs #.Nil #.Nil @@ -101,7 +101,7 @@ (def: #export (split n xs) (All [a] (-> Nat (List a) [(List a) (List a)])) - (if (n/> |0 n) + (if (n/> 0 n) (case xs #.Nil [#.Nil #.Nil] @@ -145,7 +145,7 @@ {#.doc "A list of the value x, repeated n times."} (All [a] (-> Nat a (List a))) - (if (n/> |0 n) + (if (n/> 0 n) (#.Cons [x (repeat (dec n) x)]) #.Nil)) @@ -229,7 +229,7 @@ (def: #export (size list) (All [a] (-> (List a) Nat)) - (fold (function (_ _ acc) (n/+ |1 acc)) |0 list)) + (fold (function (_ _ acc) (n/+ 1 acc)) 0 list)) (do-template [<name> <init> <op>] [(def: #export (<name> p xs) @@ -261,7 +261,7 @@ #.None (#.Cons [x xs']) - (if (n/= |0 i) + (if (n/= 0 i) (#.Some x) (nth (dec i) xs')))) @@ -382,40 +382,40 @@ ## [Syntax] (def: (identifier$ name) (-> Text Code) - [["" |0 |0] (#.Identifier "" name)]) + [["" 0 0] (#.Identifier "" name)]) (def: (nat/encode value) (-> Nat Text) (loop [input value output ""] - (let [digit (case (n/% |10 input) - |0 "0" - |1 "1" - |2 "2" - |3 "3" - |4 "4" - |5 "5" - |6 "6" - |7 "7" - |8 "8" - |9 "9" + (let [digit (case (n/% 10 input) + 0 "0" + 1 "1" + 2 "2" + 3 "3" + 4 "4" + 5 "5" + 6 "6" + 7 "7" + 8 "8" + 9 "9" _ (undefined)) output' ("lux text concat" digit output) - input' (n// |10 input)] - (if (n/= |0 input') + input' (n// 10 input)] + (if (n/= 0 input') ("lux text concat" "+" output') (recur input' output'))))) (macro: #export (zip tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zip2 (zip |2)) - (def: #export zip3 (zip |3)) - ((zip |3) xs ys zs))} + (def: #export zip2 (zip 2)) + (def: #export zip3 (zip 3)) + ((zip 3) xs ys zs))} (case tokens (^ (list [_ (#.Nat num-lists)])) - (if (n/> |0 num-lists) + (if (n/> 0 num-lists) (let [(^open ".") Functor<List> - indices (n/range |0 (dec num-lists)) + indices (n/range 0 (dec num-lists)) type-vars (: (List Code) (map (|>> nat/encode identifier$) indices)) zip-type (` (All [(~+ type-vars)] (-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var))))) @@ -447,19 +447,19 @@ _ (#.Left "Wrong syntax for zip"))) -(def: #export zip2 (zip |2)) -(def: #export zip3 (zip |3)) +(def: #export zip2 (zip 2)) +(def: #export zip3 (zip 3)) (macro: #export (zip-with tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zip2-with (zip-with |2)) - (def: #export zip3-with (zip-with |3)) - ((zip-with |2) i/+ xs ys))} + (def: #export zip2-with (zip-with 2)) + (def: #export zip3-with (zip-with 3)) + ((zip-with 2) i/+ xs ys))} (case tokens (^ (list [_ (#.Nat num-lists)])) - (if (n/> |0 num-lists) + (if (n/> 0 num-lists) (let [(^open ".") Functor<List> - indices (n/range |0 (dec num-lists)) + indices (n/range 0 (dec num-lists)) g!return-type (identifier$ "\treturn-type\t") g!func (identifier$ "\tfunc\t") type-vars (: (List Code) (map (|>> nat/encode identifier$) indices)) @@ -494,8 +494,8 @@ _ (#.Left "Wrong syntax for zip-with"))) -(def: #export zip2-with (zip-with |2)) -(def: #export zip3-with (zip-with |3)) +(def: #export zip2-with (zip-with 2)) +(def: #export zip3-with (zip-with 3)) (def: #export (last xs) (All [a] (-> (List a) (Maybe a))) @@ -545,7 +545,7 @@ (do Monad<M> [lMla MlMla ## TODO: Remove this version ASAP and use one below. - lla (: (($ |0) (List (List ($ |1)))) + lla (: (($ 0) (List (List ($ 1)))) (monad.seq @ lMla)) ## lla (monad.seq @ lMla) ] @@ -567,11 +567,11 @@ (def: #export (enumerate xs) {#.doc "Pairs every element in the list with its index, starting at 0."} (All [a] (-> (List a) (List [Nat a]))) - (enumerate' |0 xs)) + (enumerate' 0 xs)) (def: #export (indices size) {#.doc "Produces all the valid indices for a given size."} (All [a] (-> Nat (List Nat))) - (if (n/= |0 size) + (if (n/= 0 size) (list) - (|> size dec (n/range |0)))) + (|> size dec (n/range 0)))) diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index a5aa7dd73..1af9acaab 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -32,13 +32,13 @@ (All [a] (-> (Queue a) Nat)) (case queue #.None - |0 + 0 (#.Some fingers) (loop [node (get@ #finger.node fingers)] (case node (#finger.Leaf _ _) - |1 + 1 (#finger.Branch _ left right) (n/+ (recur left) (recur right)))))) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index c9e2c6786..3951aadd1 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -35,11 +35,11 @@ (def: branching-exponent Nat - |5) + 5) (def: root-level Level - |0) + 0) (do-template [<name> <op>] [(def: <name> @@ -52,7 +52,7 @@ (def: full-node-size Nat - (i64.left-shift branching-exponent |1)) + (i64.left-shift branching-exponent 1)) (def: branch-idx-mask Nat @@ -69,23 +69,23 @@ (def: (tail-off vec-size) (-> Nat Nat) (if (n/< full-node-size vec-size) - |0 + 0 (|> (dec vec-size) (i64.logical-right-shift branching-exponent) (i64.left-shift branching-exponent)))) (def: (new-path level tail) (All [a] (-> Level (Base a) (Node a))) - (if (n/= |0 level) + (if (n/= 0 level) (#Base tail) (|> (new-hierarchy []) - (array.write |0 (new-path (level-down level) tail)) + (array.write 0 (new-path (level-down level) tail)) #Hierarchy))) (def: (new-tail singleton) (All [a] (-> a (Base a))) - (|> (array.new |1) - (array.write |0 singleton))) + (|> (array.new 1) + (array.write 0 singleton))) (def: (push-tail size level tail parent) (All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a))) @@ -113,7 +113,7 @@ (All [a] (-> a (Base a) (Base a))) (let [tail-size (array.size tail)] (|> (array.new (inc tail-size)) - (array.copy tail-size |0 tail |0) + (array.copy tail-size 0 tail 0) (array.write tail-size val)))) (def: (put' level idx val hierarchy) @@ -125,7 +125,7 @@ (array.write sub-idx (#Hierarchy (put' (level-down level) idx val sub-node)))) (^multi (#.Some (#Base base)) - (n/= |0 (level-down level))) + (n/= 0 (level-down level))) (|> (array.clone hierarchy) (array.write sub-idx (|> (array.clone base) (array.write (branch-idx idx) val) @@ -136,8 +136,8 @@ (def: (pop-tail size level hierarchy) (All [a] (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) - (let [sub-idx (branch-idx (i64.logical-right-shift level (n/- |2 size)))] - (cond (n/= |0 sub-idx) + (let [sub-idx (branch-idx (i64.logical-right-shift level (n/- 2 size)))] + (cond (n/= 0 sub-idx) #.None (n/> branching-exponent level) @@ -183,9 +183,9 @@ (def: #export empty Row {#level (level-up root-level) - #size |0 + #size 0 #root (array.new full-node-size) - #tail (array.new |0)}) + #tail (array.new 0)}) (def: #export (size row) (All [a] (-> (Row a) Nat)) @@ -203,17 +203,17 @@ ## Otherwise, push tail into the tree ## -------------------------------------------------------- ## Will the root experience an overflow with this addition? - (|> (if (n/> (i64.left-shift (get@ #level vec) |1) + (|> (if (n/> (i64.left-shift (get@ #level vec) 1) (i64.logical-right-shift branching-exponent vec-size)) ## If so, a brand-new root must be established, that is ## 1-level taller. (|> vec - (set@ #root (|> (: (Hierarchy ($ |0)) + (set@ #root (|> (: (Hierarchy ($ 0)) (new-hierarchy [])) ## TODO: Remove version above once new-luxc becomes the standard compiler. ## (new-hierarchy []) - (array.write |0 (#Hierarchy (get@ #root vec))) - (array.write |1 (new-path (get@ #level vec) (get@ #tail vec))))) + (array.write 0 (#Hierarchy (get@ #root vec))) + (array.write 1 (new-path (get@ #level vec) (get@ #tail vec))))) (update@ #level level-up)) ## Otherwise, just push the current tail onto the root. (|> vec @@ -227,7 +227,7 @@ (def: (base-for idx vec) (All [a] (-> Index (Row a) (Maybe (Base a)))) (let [vec-size (get@ #size vec)] - (if (and (n/>= |0 idx) + (if (and (n/>= 0 idx) (n/< vec-size idx)) (if (n/>= (tail-off vec-size) idx) (#.Some (get@ #tail vec)) @@ -257,13 +257,13 @@ (def: #export (put idx val vec) (All [a] (-> Nat a (Row a) (Row a))) (let [vec-size (get@ #size vec)] - (if (and (n/>= |0 idx) + (if (and (n/>= 0 idx) (n/< vec-size idx)) (if (n/>= (tail-off vec-size) idx) (|> vec ## (update@ #tail (|>> array.clone (array.write (branch-idx idx) val))) ## TODO: Remove once new-luxc becomes the standard compiler. - (update@ #tail (: (-> (Base ($ |0)) (Base ($ |0))) + (update@ #tail (: (-> (Base ($ 0)) (Base ($ 0))) (|>> array.clone (array.write (branch-idx idx) val)))) ) (|> vec @@ -282,29 +282,29 @@ (def: #export (pop vec) (All [a] (-> (Row a) (Row a))) (case (get@ #size vec) - |0 + 0 empty - |1 + 1 empty vec-size - (if (|> vec-size (n/- (tail-off vec-size)) (n/> |1)) + (if (|> vec-size (n/- (tail-off vec-size)) (n/> 1)) (let [old-tail (get@ #tail vec) new-tail-size (dec (array.size old-tail))] (|> vec (update@ #size dec) (set@ #tail (|> (array.new new-tail-size) - (array.copy new-tail-size |0 old-tail |0))))) + (array.copy new-tail-size 0 old-tail 0))))) (maybe.assume (do maybe.Monad<Maybe> - [new-tail (base-for (n/- |2 vec-size) vec) + [new-tail (base-for (n/- 2 vec-size) vec) #let [[level' root'] (let [init-level (get@ #level vec)] (loop [level init-level root (maybe.default (new-hierarchy []) (pop-tail vec-size init-level (get@ #root vec)))] (if (n/> branching-exponent level) - (case [(array.read |1 root) (array.read |0 root)] + (case [(array.read 1 root) (array.read 0 root)] [#.None (#.Some (#Hierarchy sub-node))] (recur (level-down level) sub-node) @@ -338,7 +338,7 @@ (def: #export empty? (All [a] (-> (Row a) Bit)) - (|>> (get@ #size) (n/= |0))) + (|>> (get@ #size) (n/= 0))) ## [Syntax] (syntax: #export (row {elems (p.some s.any)}) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index ed06547c2..6529a1ced 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -62,7 +62,7 @@ (def: #export (nth idx s) (All [a] (-> Nat (Sequence a) a)) (let [[h t] (continuation.run s)] - (if (n/> |0 idx) + (if (n/> 0 idx) (nth (dec idx) t) h))) @@ -93,7 +93,7 @@ [(list) xs])))] [take-while drop-while split-while (-> a Bit) (pred x) pred] - [take drop split Nat (n/> |0 pred) (dec pred)] + [take drop split Nat (n/> 0 pred) (dec pred)] ) (def: #export (unfold step init) diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux index cab4105b0..6de27eb24 100644 --- a/stdlib/source/lux/data/collection/set.lux +++ b/stdlib/source/lux/data/collection/set.lux @@ -65,13 +65,13 @@ (def: (hash set) (let [[Hash<a> _] (:representation set)] (list/fold (function (_ elem acc) (n/+ (:: Hash<a> hash elem) acc)) - |0 + 0 (..to-list set))))) ) (def: #export empty? (All [a] (-> (Set a) Bit)) - (|>> ..size (n/= |0))) + (|>> ..size (n/= 0))) (def: #export (from-list Hash<a> xs) (All [a] (-> (Hash a) (List a) (Set a))) diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux index 91fd7f675..d152c8506 100644 --- a/stdlib/source/lux/data/collection/set/multi.lux +++ b/stdlib/source/lux/data/collection/set/multi.lux @@ -25,15 +25,15 @@ (def: #export size (All [a] (-> (Set a) Nat)) - (|>> :representation dictionary.values (list/fold n/+ |0))) + (|>> :representation dictionary.values (list/fold n/+ 0))) (def: #export (add/* count elem set) (All [a] (-> Nat a (Set a) (Set a))) - (|> set :representation (dictionary.update~ elem |0 (n/+ count)) :abstraction)) + (|> set :representation (dictionary.update~ elem 0 (n/+ count)) :abstraction)) (def: #export add/1 (All [a] (-> a (Set a) (Set a))) - (add/* |1)) + (add/* 1)) (def: #export (remove/* count elem set) (All [a] (-> Nat a (Set a) (Set a))) @@ -53,18 +53,18 @@ (def: #export remove/1 (All [a] (-> a (Set a) (Set a))) - (remove/* |1)) + (remove/* 1)) (def: #export (multiplicity elem set) (All [a] (-> a (Set a) Nat)) - (|> set :representation (dictionary.get elem) (maybe.default |0))) + (|> set :representation (dictionary.get elem) (maybe.default 0))) (def: #export to-list (All [a] (-> (Set a) (List a))) (let [append (: (All [a] (-> a Nat (List a) (List a))) (function (append elem count output) (case count - |0 output + 0 output _ (|> output (#.Cons elem) (append elem (dec count))))))] (|>> :representation dictionary.entries @@ -105,7 +105,7 @@ (|> reference :representation (dictionary.get elem) - (maybe.default |0) + (maybe.default 0) (n/>= count)))))) (def: #export (support set) @@ -124,7 +124,7 @@ (list.every? (function (_ [elem count]) (|> sample (dictionary.get elem) - (maybe.default |0) + (maybe.default 0) (n/= count)))))))) (structure: #export Hash<Set> (All [a] (Hash (Set a))) @@ -134,17 +134,17 @@ (let [[Hash<a> _] set] (list/fold (function (_ [elem count] acc) (|> elem (:: Hash<a> hash) (n/* count) (n/+ acc))) - |0 + 0 (dictionary.entries set))))) ) (def: #export (member? set elem) (All [a] (-> (Set a) a Bit)) - (|> set (..multiplicity elem) (n/> |0))) + (|> set (..multiplicity elem) (n/> 0))) (def: #export empty? (All [a] (-> (Set a) Bit)) - (|>> ..size (n/= |0))) + (|>> ..size (n/= 0))) (def: #export (from-list Hash<a> subject) (All [a] (-> (Hash a) (List a) (Set a))) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index b732f87b2..f9380577b 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -86,7 +86,7 @@ (#.Some parent) (|> parent ## TODO: Remove once new-luxc becomes the standard compiler. - (update@ #node (: (-> (Tree ($ |0)) (Tree ($ |0))) + (update@ #node (: (-> (Tree ($ 0)) (Tree ($ 0))) (function (_ node) (set@ #//.children (list/compose (list.reverse (get@ #lefts zipper)) (#.Cons (get@ #node zipper) @@ -155,7 +155,7 @@ (update@ [#node #//.children] (function (_ children) ## TODO: Remove once new-luxc becomes the standard compiler. - (list& (: (Tree ($ |0)) + (list& (: (Tree ($ 0)) (//.tree [value {}])) children) ## (list& (//.tree [value {}]) @@ -169,7 +169,7 @@ (function (_ children) (list/compose children ## TODO: Remove once new-luxc becomes the standard compiler. - (list (: (Tree ($ |0)) + (list (: (Tree ($ 0)) (//.tree [value {}]))) ## (list (//.tree [value {}])) )) @@ -203,7 +203,7 @@ (#.Some (|> zipper (update@ <side> (function (_ side) ## TODO: Remove once new-luxc becomes the standard compiler. - (#.Cons (: (Tree ($ |0)) + (#.Cons (: (Tree ($ 0)) (//.tree [value {}])) side) ## (#.Cons (//.tree [value {}]) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 2eb8bd35f..e070ced40 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -8,7 +8,7 @@ [type abstract]]) -(def: rgb Nat |256) +(def: rgb Nat 256) (def: top Nat (dec rgb)) (def: rgb-factor Frac (|> top .int int-to-frac)) @@ -155,9 +155,9 @@ t (|> +1.0 (f/- (|> +1.0 (f/- f) (f/* saturation))) (f/* brightness)) v brightness mod (|> i (f/% +6.0) frac-to-int .nat) - red (case mod |0 v |1 q |2 p |3 p |4 t |5 v _ (undefined)) - green (case mod |0 t |1 v |2 v |3 q |4 p |5 p _ (undefined)) - blue (case mod |0 p |1 p |2 t |3 v |4 v |5 q _ (undefined))] + red (case mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined)) + green (case mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined)) + blue (case mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))] (color [(scale-up red) (scale-up green) (scale-up blue)]))) @@ -180,7 +180,7 @@ (def: #export (from-cmyk [cyan magenta yellow key]) (-> [Frac Frac Frac Frac] Color) (if (f/= +1.0 key) - (color [|0 |0 |0]) + (color [0 0 0]) (let [red (|> (|> +1.0 (f/- cyan)) (f/* (|> +1.0 (f/- key)))) green (|> (|> +1.0 (f/- magenta)) @@ -216,7 +216,7 @@ (interpolate' greenE greenS) (interpolate' blueE blueS)]))) -(def: black Color (color [|0 |0 |0])) +(def: black Color (color [0 0 0])) (def: white Color (color [top top top])) (do-template [<name> <target>] @@ -283,7 +283,7 @@ (def: #export (analogous results slice color) (-> Nat Frac Color (List Color)) - (if (n/= |0 results) + (if (n/= 0 results) (list) (let [[hue saturation luminance] (to-hsl color) slice (normalize slice)] @@ -291,15 +291,15 @@ (from-hsl [(|> idx .int int-to-frac (f/* slice) (f/+ hue) normalize) saturation luminance])) - (list.n/range |0 (dec results)))))) + (list.n/range 0 (dec results)))))) (def: #export (monochromatic results color) (-> Nat Color (List Color)) - (if (n/= |0 results) + (if (n/= 0 results) (list) (let [[hue saturation brightness] (to-hsb color) slice (|> +1.0 (f// (|> results .int int-to-frac)))] - (|> (list.n/range |0 (dec results)) + (|> (list.n/range 0 (dec results)) (list/map (|>> .int int-to-frac (f/* slice) (f/+ brightness) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index c5c7cbb89..4657b48d5 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -28,10 +28,10 @@ (type: #export Size Nat) -(def: #export size/8 |1) -(def: #export size/16 |2) -(def: #export size/32 |4) -(def: #export size/64 |8) +(def: #export size/8 1) +(def: #export size/16 2) +(def: #export size/32 4) +(def: #export size/64 8) (type: #export Read (p.Parser [Offset Binary])) @@ -46,7 +46,7 @@ ## Operators (def: #export (read format input) (All [a] (-> (Format a) Binary (Error a))) - (case ((get@ #read format) [|0 input]) + (case ((get@ #read format) [0 input]) (#error.Error msg) (#error.Error msg) @@ -59,7 +59,7 @@ (def: #export (write format value) (All [a] (-> (Format a) a Binary)) (let [[valueS valueT] ((get@ #write format) value)] - (|> valueS binary.create (valueT |0)))) + (|> valueS binary.create (valueT 0)))) ## Primitives (do-template [<name> <size> <read> <write>] @@ -91,9 +91,9 @@ {#read (do p.Monad<Parser> [flag (get@ #read bits/8)] (case flag - |0 (:: @ map (|>> #.Left) (get@ #read leftB)) - |1 (:: @ map (|>> #.Right) (get@ #read rightB)) - _ (p.lift (ex.throw invalid-tag [|2 (.nat flag)])))) + 0 (:: @ map (|>> #.Left) (get@ #read leftB)) + 1 (:: @ map (|>> #.Right) (get@ #read rightB)) + _ (p.lift (ex.throw invalid-tag [2 (.nat flag)])))) #write (function (_ altV) (case altV (#.Left leftV) @@ -101,7 +101,7 @@ [(.inc leftS) (function (_ offset binary) (|> binary - (binary.write/8 offset |0) + (binary.write/8 offset 0) error.assume (leftT (.inc offset))))]) @@ -110,7 +110,7 @@ [(.inc rightS) (function (_ offset binary) (|> binary - (binary.write/8 offset |1) + (binary.write/8 offset 1) error.assume (rightT (.inc offset))))]) ))}) @@ -141,7 +141,7 @@ {#read (function (_ input) (#error.Success [input default])) #write (function (_ value) - [|0 + [0 (function (_ offset binary) binary)])}) @@ -157,19 +157,19 @@ (case (: Nat data) (^template [<nat> <bit>] <nat> (#error.Success [(inc offset) binary] <bit>)) - ([|0 #0] - [|1 #1]) + ([0 #0] + [1 #1]) _ - (ex.throw invalid-tag [|2 data])) + (ex.throw invalid-tag [2 data])) (#error.Error error) (#error.Error error))) #write (function (_ value) - [|1 + [1 (function (_ offset binary) (|> binary - (binary.write/8 offset (if value |1 |0)) + (binary.write/8 offset (if value 1 0)) error.assume))])}) (def: #export nat (Format Nat) (:assume ..bits/64)) @@ -198,7 +198,7 @@ (error.assume (do error.Monad<Error> [_ (binary.write/64 offset size binary)] - (binary.copy size |0 value (n/+ size/64 offset) binary))))]))}) + (binary.copy size 0 value (n/+ size/64 offset) binary))))]))}) (def: #export text (Format Text) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 573e422d6..13ffe71da 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -51,8 +51,8 @@ (def: abs id) (def: (signum x) (case x - |0 |0 - _ |1)) + 0 0 + _ 1)) ) (do-template [<type> <order> <+> <-> <*> </> <%> <=> <<> <0> <1> <-1>] @@ -107,10 +107,10 @@ (def: top <top>) (def: bottom <bottom>))] - [ Nat Enum<Nat> (:coerce Nat -1) |0] + [ Nat Enum<Nat> (:coerce Nat -1) 0] [ Int Enum<Int> +9_223_372_036_854_775_807 -9_223_372_036_854_775_808] [Frac Enum<Frac> ("lux frac max") ("lux frac min")] - [ Rev Enum<Rev> (:coerce Rev -1) (:coerce Rev |0)] + [ Rev Enum<Rev> (:coerce Rev -1) (:coerce Rev 0)] ) (do-template [<name> <type> <identity> <compose>] @@ -118,8 +118,8 @@ (def: identity <identity>) (def: compose <compose>))] - [ Add@Monoid<Nat> Nat |0 n/+] - [ Mul@Monoid<Nat> Nat |1 n/*] + [ Add@Monoid<Nat> Nat 0 n/+] + [ Mul@Monoid<Nat> Nat 1 n/*] [ Max@Monoid<Nat> Nat (:: Interval<Nat> bottom) n/max] [ Min@Monoid<Nat> Nat (:: Interval<Nat> top) n/min] [ Add@Monoid<Int> Int +0 i/+] @@ -182,113 +182,113 @@ (def: (binary-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") + 0 (#.Some "0") + 1 (#.Some "1") _ #.None)) (def: (binary-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) + "0" (#.Some 0) + "1" (#.Some 1) _ #.None)) (def: (octal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") _ #.None)) (def: (octal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) _ #.None)) (def: (decimal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") - |8 (#.Some "8") - |9 (#.Some "9") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") + 8 (#.Some "8") + 9 (#.Some "9") _ #.None)) (def: (decimal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) - "8" (#.Some |8) - "9" (#.Some |9) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) + "8" (#.Some 8) + "9" (#.Some 9) _ #.None)) (def: (hexadecimal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") - |8 (#.Some "8") - |9 (#.Some "9") - |10 (#.Some "A") - |11 (#.Some "B") - |12 (#.Some "C") - |13 (#.Some "D") - |14 (#.Some "E") - |15 (#.Some "F") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") + 8 (#.Some "8") + 9 (#.Some "9") + 10 (#.Some "A") + 11 (#.Some "B") + 12 (#.Some "C") + 13 (#.Some "D") + 14 (#.Some "E") + 15 (#.Some "F") _ #.None)) (def: (hexadecimal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) - "8" (#.Some |8) - "9" (#.Some |9) - (^or "a" "A") (#.Some |10) - (^or "b" "B") (#.Some |11) - (^or "c" "C") (#.Some |12) - (^or "d" "D") (#.Some |13) - (^or "e" "E") (#.Some |14) - (^or "f" "F") (#.Some |15) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) + "8" (#.Some 8) + "9" (#.Some 9) + (^or "a" "A") (#.Some 10) + (^or "b" "B") (#.Some 11) + (^or "c" "C") (#.Some 12) + (^or "d" "D") (#.Some 13) + (^or "e" "E") (#.Some 14) + (^or "f" "F") (#.Some 15) _ #.None)) (do-template [<struct> <base> <to-character> <to-value> <error>] @@ -299,36 +299,31 @@ (let [digit (maybe.assume (<to-character> (n/% <base> input))) output' ("lux text concat" digit output) input' (n// <base> input)] - (if (n/= |0 input') - ("lux text concat" "|" output') + (if (n/= 0 input') + output' (recur input' output'))))) (def: (decode repr) (let [input-size ("lux text size" repr)] - (if (n/>= |2 input-size) - (case ("lux text char" repr |0) - (^ (#.Some (char "|"))) - (loop [idx |1 - output |0] - (if (n/< input-size idx) - (let [digit (maybe.assume (get-char repr idx))] - (case (<to-value> digit) - #.None - (#error.Error ("lux text concat" <error> repr)) - - (#.Some digit-value) - (recur (inc idx) - (|> output (n/* <base>) (n/+ digit-value))))) - (#error.Success output))) - - _ - (#error.Error ("lux text concat" <error> repr))) + (if (n/> 0 input-size) + (loop [idx 0 + output 0] + (if (n/< input-size idx) + (let [digit (maybe.assume (get-char repr idx))] + (case (<to-value> digit) + #.None + (#error.Error ("lux text concat" <error> repr)) + + (#.Some digit-value) + (recur (inc idx) + (|> output (n/* <base>) (n/+ digit-value))))) + (#error.Success output))) (#error.Error ("lux text concat" <error> repr))))))] - [Binary@Codec<Text,Nat> |2 binary-character binary-value "Invalid binary syntax for Nat: "] - [Octal@Codec<Text,Nat> |8 octal-character octal-value "Invalid octal syntax for Nat: "] - [_ |10 decimal-character decimal-value "Invalid syntax for Nat: "] - [Hex@Codec<Text,Nat> |16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Nat: "] + [Binary@Codec<Text,Nat> 2 binary-character binary-value "Invalid binary syntax for Nat: "] + [Octal@Codec<Text,Nat> 8 octal-character octal-value "Invalid octal syntax for Nat: "] + [_ 10 decimal-character decimal-value "Invalid syntax for Nat: "] + [Hex@Codec<Text,Nat> 16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Nat: "] ) (def: (int/sign!! value) @@ -339,7 +334,7 @@ (def: (int/sign?? representation) (-> Text (Maybe Int)) - (case (get-char representation |0) + (case (get-char representation 0) (^ (#.Some "-")) (#.Some -1) @@ -351,7 +346,7 @@ (def: (int-decode-loop input-size repr sign <base> <to-value> <error>) (-> Nat Text Int Int (-> Text (Maybe Nat)) Text (Error Int)) - (loop [idx |1 + (loop [idx 1 output +0] (if (n/< input-size idx) (let [digit (maybe.assume (get-char repr idx))] @@ -381,7 +376,7 @@ (def: (decode repr) (let [input-size ("lux text size" repr)] - (if (n/> |1 input-size) + (if (n/> 1 input-size) (case (int/sign?? repr) (#.Some sign) (int-decode-loop input-size repr sign <base> <to-value> <error>) @@ -398,17 +393,17 @@ (def: (de-prefix input) (-> Text Text) - (maybe.assume ("lux text clip" input |1 ("lux text size" input)))) + (maybe.assume ("lux text clip" input 1 ("lux text size" input)))) (do-template [<struct> <nat> <char-bit-size> <error>] [(structure: #export <struct> (Codec Text Rev) (def: (encode value) (let [raw-output (de-prefix (:: <nat> encode (:coerce Nat value))) - max-num-chars (n// <char-bit-size> |64) + max-num-chars (n// <char-bit-size> 64) raw-size ("lux text size" raw-output) zero-padding (loop [zeroes-left (n/- raw-size max-num-chars) output ""] - (if (n/= |0 zeroes-left) + (if (n/= 0 zeroes-left) output (recur (dec zeroes-left) ("lux text concat" "0" output)))) @@ -417,10 +412,10 @@ (def: (decode repr) (let [repr-size ("lux text size" repr)] - (if (n/>= |2 repr-size) - (case ("lux text char" repr |0) + (if (n/>= 2 repr-size) + (case ("lux text char" repr 0) (^multi (^ (#.Some (char "."))) - [(:: <nat> decode ("lux text concat" "|" (de-prefix repr))) + [(:: <nat> decode (de-prefix repr)) (#error.Success output)]) (#error.Success (:coerce Rev output)) @@ -428,9 +423,9 @@ (#error.Error ("lux text concat" <error> repr))) (#error.Error ("lux text concat" <error> repr))))))] - [Binary@Codec<Text,Rev> Binary@Codec<Text,Nat> |1 "Invalid binary syntax: "] - [Octal@Codec<Text,Rev> Octal@Codec<Text,Nat> |3 "Invalid octal syntax: "] - [Hex@Codec<Text,Rev> Hex@Codec<Text,Nat> |4 "Invalid hexadecimal syntax: "] + [Binary@Codec<Text,Rev> Binary@Codec<Text,Nat> 1 "Invalid binary syntax: "] + [Octal@Codec<Text,Rev> Octal@Codec<Text,Nat> 3 "Invalid octal syntax: "] + [Hex@Codec<Text,Rev> Hex@Codec<Text,Nat> 4 "Invalid hexadecimal syntax: "] ) (do-template [<struct> <int> <base> <char-set> <error>] @@ -453,9 +448,9 @@ ("lux text concat" whole-part decimal-part))) (def: (decode repr) - (case ("lux text index" repr "." |0) + (case ("lux text index" repr "." 0) (#.Some split-index) - (let [whole-part (maybe.assume ("lux text clip" repr |0 split-index)) + (let [whole-part (maybe.assume ("lux text clip" repr 0 split-index)) decimal-part (maybe.assume ("lux text clip" repr (inc split-index) ("lux text size" repr)))] (case [(:: <int> decode whole-part) (:: <int> decode decimal-part)] @@ -466,7 +461,7 @@ +1.0) div-power (loop [muls-left ("lux text size" decimal-part) output +1.0] - (if (n/= |0 muls-left) + (if (n/= 0 muls-left) output (recur (dec muls-left) (f/* <base> output)))) @@ -501,7 +496,7 @@ (list digits) (let [boundary (n/- chunk-size num-digits) chunk (maybe.assume ("lux text clip" digits boundary num-digits)) - remaining (maybe.assume ("lux text clip" digits |0 boundary))] + remaining (maybe.assume ("lux text clip" digits 0 boundary))] (list& chunk (segment-digits chunk-size remaining))))))) (def: (bin-segment-to-hex input) @@ -593,15 +588,15 @@ (do-template [<from> <from-translator> <to> <to-translator> <base-bits>] [(def: (<from> on-left? input) (-> Bit Text Text) - (let [max-num-chars (n// <base-bits> |64) + (let [max-num-chars (n// <base-bits> 64) input-size ("lux text size" input) zero-padding (let [num-digits-that-need-padding (n/% <base-bits> input-size)] - (if (n/= |0 num-digits-that-need-padding) + (if (n/= 0 num-digits-that-need-padding) "" (loop [zeroes-left (n/- num-digits-that-need-padding <base-bits>) output ""] - (if (n/= |0 zeroes-left) + (if (n/= 0 zeroes-left) output (recur (dec zeroes-left) ("lux text concat" "0" output)))))) @@ -615,12 +610,12 @@ (def: <to> (-> Text Text) - (|>> (segment-digits |1) + (|>> (segment-digits 1) (map <to-translator>) re-join-chunks))] - [binary-to-hex bin-segment-to-hex hex-to-binary hex-segment-to-bin |4] - [binary-to-octal bin-segment-to-octal octal-to-binary octal-segment-to-bin |3] + [binary-to-hex bin-segment-to-hex hex-to-binary hex-segment-to-bin 4] + [binary-to-octal bin-segment-to-octal octal-to-binary octal-segment-to-bin 3] ) (do-template [<struct> <error> <from> <to>] @@ -628,9 +623,9 @@ (def: (encode value) (let [sign (:: Number<Frac> signum value) raw-bin (:: Binary@Codec<Text,Frac> encode value) - dot-idx (maybe.assume ("lux text index" raw-bin "." |0)) + dot-idx (maybe.assume ("lux text index" raw-bin "." 0)) whole-part (maybe.assume ("lux text clip" raw-bin - (if (f/= -1.0 sign) |1 |0) + (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> #0 decimal-part) @@ -640,15 +635,15 @@ hex-output)) (def: (decode repr) - (let [sign (case ("lux text index" repr "-" |0) - (#.Some |0) + (let [sign (case ("lux text index" repr "-" 0) + (#.Some 0) -1.0 _ +1.0)] - (case ("lux text index" repr "." |0) + (case ("lux text index" repr "." 0) (#.Some split-index) - (let [whole-part (maybe.assume ("lux text clip" repr (if (f/= -1.0 sign) |1 |0) split-index)) + (let [whole-part (maybe.assume ("lux text clip" repr (if (f/= -1.0 sign) 1 0) split-index)) decimal-part (maybe.assume ("lux text clip" repr (inc split-index) ("lux text size" repr))) as-binary (|> (<to> decimal-part) ("lux text concat" ".") @@ -688,8 +683,8 @@ (def: (underscore-prefixed? number) (-> Text Bit) - (case ("lux text index" number "_" |0) - (#.Some |0) + (case ("lux text index" number "_" 0) + (#.Some 0) #1 _ @@ -758,7 +753,7 @@ (def: (digits-get idx digits) (-> Nat Digits Nat) - (maybe.default |0 ("lux array get" digits idx))) + (maybe.default 0 ("lux array get" digits idx))) (def: (digits-put idx digit digits) (-> Nat Nat Digits Digits) @@ -771,22 +766,22 @@ (def: (digits-times-5! idx output) (-> Nat Digits Digits) (loop [idx idx - carry |0 + carry 0 output output] (if (i/>= +0 (:coerce Int idx)) (let [raw (|> (digits-get idx output) - (n/* |5) + (n/* 5) (n/+ carry))] (recur (dec idx) - (n// |10 raw) - (digits-put idx (n/% |10 raw) output))) + (n// 10 raw) + (digits-put idx (n/% 10 raw) output))) output))) (def: (digits-power power) (-> Nat Digits) (loop [times power output (|> (make-digits []) - (digits-put power |1))] + (digits-put power 1))] (if (i/>= +0 (:coerce Int times)) (recur (dec times) (digits-times-5! power output)) @@ -799,7 +794,7 @@ output ""] (if (i/>= +0 (:coerce Int idx)) (let [digit (digits-get idx digits)] - (if (and (n/= |0 digit) + (if (and (n/= 0 digit) all-zeroes?) (recur (dec idx) #1 output) (recur (dec idx) @@ -814,7 +809,7 @@ (def: (digits-add param subject) (-> Digits Digits Digits) (loop [idx (dec i64.width) - carry |0 + carry 0 output (make-digits [])] (if (i/>= +0 (:coerce Int idx)) (let [raw ($_ n/+ @@ -822,19 +817,19 @@ (digits-get idx param) (digits-get idx subject))] (recur (dec idx) - (n// |10 raw) - (digits-put idx (n/% |10 raw) output))) + (n// 10 raw) + (digits-put idx (n/% 10 raw) output))) output))) (def: (text-to-digits input) (-> Text (Maybe Digits)) (let [length ("lux text size" input)] (if (n/<= i64.width length) - (loop [idx |0 + (loop [idx 0 output (make-digits [])] (if (n/< length idx) (let [char (maybe.assume (get-char input idx))] - (case ("lux text index" "+0123456789" char |0) + (case ("lux text index" "+0123456789" char 0) #.None #.None @@ -846,7 +841,7 @@ (def: (digits-lt param subject) (-> Digits Digits Bit) - (loop [idx |0] + (loop [idx 0] (and (n/< i64.width idx) (let [pd (digits-get idx param) sd (digits-get idx subject)] @@ -860,11 +855,11 @@ (if (n/>= param sd) (digits-put idx (n/- param sd) subject) (let [diff (|> sd - (n/+ |10) + (n/+ 10) (n/- param))] (|> subject (digits-put idx diff) - (digits-sub-once! (dec idx) |1)))))) + (digits-sub-once! (dec idx) 1)))))) (def: (digits-sub! param subject) (-> Digits Digits Digits) @@ -879,7 +874,7 @@ (def: (encode input) (let [input (:coerce Nat input) last-idx (dec i64.width)] - (if (n/= |0 input) + (if (n/= 0 input) ".0" (loop [idx last-idx digits (make-digits [])] @@ -896,21 +891,21 @@ (def: (decode input) (let [length ("lux text size" input) - dotted? (case ("lux text index" input "." |0) - (#.Some |0) + dotted? (case ("lux text index" input "." 0) + (#.Some 0) #1 _ #0)] (if (and dotted? (n/<= (inc i64.width) length)) - (case (|> ("lux text clip" input |1 length) + (case (|> ("lux text clip" input 1 length) maybe.assume text-to-digits) (#.Some digits) (loop [digits digits - idx |0 - output |0] + idx 0 + output 0] (if (n/< i64.width idx) (let [power (digits-power idx)] (if (digits-lt power digits) @@ -931,58 +926,58 @@ (f// ("lux math log" +2.0) ("lux math log" input))) -(def: double-bias Nat |1023) +(def: double-bias Nat 1023) -(def: mantissa-size Nat |52) -(def: exponent-size Nat |11) +(def: mantissa-size Nat 52) +(def: exponent-size Nat 11) (def: #export (frac-to-bits input) (-> Frac I64) (i64 (cond (not-a-number? input) - (hex "|7FF7FFFFFFFFFFFF") + (hex "7FF7FFFFFFFFFFFF") (f/= positive-infinity input) - (hex "|7FF0000000000000") + (hex "7FF0000000000000") (f/= negative-infinity input) - (hex "|FFF0000000000000") + (hex "FFF0000000000000") (f/= +0.0 input) (let [reciprocal (f// input +1.0)] (if (f/= positive-infinity reciprocal) ## Positive zero - (hex "|0000000000000000") + (hex "0000000000000000") ## Negative zero - (hex "|8000000000000000"))) + (hex "8000000000000000"))) ## else (let [sign (:: Number<Frac> signum input) input (:: Number<Frac> abs input) exponent ("lux math floor" (log2 input)) - exponent-mask (|> |1 (i64.left-shift exponent-size) dec) + exponent-mask (|> 1 (i64.left-shift exponent-size) dec) mantissa (|> input ## Normalize (f// ("lux math pow" +2.0 exponent)) ## Make it int-equivalent (f/* ("lux math pow" +2.0 +52.0))) - sign-bit (if (f/= -1.0 sign) |1 |0) + sign-bit (if (f/= -1.0 sign) 1 0) exponent-bits (|> exponent frac-to-int .nat (n/+ double-bias) (i64.and exponent-mask)) mantissa-bits (|> mantissa frac-to-int .nat)] ($_ i64.or - (i64.left-shift |63 sign-bit) + (i64.left-shift 63 sign-bit) (i64.left-shift mantissa-size exponent-bits) (i64.clear mantissa-size mantissa-bits))) ))) (do-template [<getter> <mask> <size> <offset>] - [(def: <mask> (|> |1 (i64.left-shift <size>) dec (i64.left-shift <offset>))) + [(def: <mask> (|> 1 (i64.left-shift <size>) dec (i64.left-shift <offset>))) (def: (<getter> input) (-> (I64 Any) I64) (|> input (i64.and <mask>) (i64.logical-right-shift <offset>) i64))] - [mantissa mantissa-mask mantissa-size |0] + [mantissa mantissa-mask mantissa-size 0] [exponent exponent-mask exponent-size mantissa-size] - [sign sign-mask |1 (n/+ exponent-size mantissa-size)] + [sign sign-mask 1 (n/+ exponent-size mantissa-size)] ) (def: #export (bits-to-frac input) @@ -990,15 +985,15 @@ (let [S (sign input) E (exponent input) M (mantissa input)] - (cond (n/= (hex "|7FF") E) - (if (n/= |0 M) - (if (n/= |0 S) + (cond (n/= (hex "7FF") E) + (if (n/= 0 M) + (if (n/= 0 S) positive-infinity negative-infinity) not-a-number) - (and (n/= |0 E) (n/= |0 M)) - (if (n/= |0 S) + (and (n/= 0 E) (n/= 0 M)) + (if (n/= 0 S) +0.0 (f/* -1.0 +0.0)) @@ -1011,7 +1006,7 @@ ("lux math pow" +2.0)) shifted (f/* power normalized)] - (if (n/= |0 S) + (if (n/= 0 S) shifted (f/* -1.0 shifted)))))) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index fb0401582..cd785fb31 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -291,13 +291,13 @@ (def: #export (roots nth input) (-> Nat Complex (List Complex)) - (if (n/= |0 nth) + (if (n/= 0 nth) (list) (let [r-nth (|> nth .int int-to-frac) nth-root-of-abs (|> input abs (get@ #real) (math.pow (f// r-nth +1.0))) nth-phi (|> input argument (f// r-nth)) slice (|> math.pi (f/* +2.0) (f// r-nth))] - (|> (list.n/range |0 (dec nth)) + (|> (list.n/range 0 (dec nth)) (list/map (function (_ nth') (let [inner (|> nth' .int int-to-frac (f/* slice) diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 9d1e8794b..aba61ad3e 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -1,6 +1,6 @@ (.module: [lux (#- and or not)]) -(def: #export width Nat |64) +(def: #export width Nat 64) ## [Values] (do-template [<name> <op> <doc>] @@ -32,15 +32,15 @@ (def: #export (count subject) {#.doc "Count the number of 1s in a bit-map."} (-> (I64 Any) Nat) - (let [count' (n/- (|> subject (logical-right-shift |1) (..and |6148914691236517205) i64) + (let [count' (n/- (|> subject (logical-right-shift 1) (..and 6148914691236517205) i64) (i64 subject))] (|> count' - (logical-right-shift |2) (..and |3689348814741910323) (n/+ (..and |3689348814741910323 count')) - (add-shift |4) (..and |1085102592571150095) - (add-shift |8) - (add-shift |16) - (add-shift |32) - (..and |127)))) + (logical-right-shift 2) (..and 3689348814741910323) (n/+ (..and 3689348814741910323 count')) + (add-shift 4) (..and 1085102592571150095) + (add-shift 8) + (add-shift 16) + (add-shift 32) + (..and 127)))) (def: #export not {#.doc "Bitwise negation."} @@ -49,7 +49,7 @@ (def: (flag idx) (-> Nat I64) - (|> |1 (:coerce I64) (left-shift idx))) + (|> 1 (:coerce I64) (left-shift idx))) (def: #export (clear idx input) {#.doc "Clear bit at given index."} @@ -68,7 +68,7 @@ (def: #export (set? idx input) (-> Nat (I64 Any) Bit) - (|> input (:coerce I64) (..and (flag idx)) (n/= |0) .not)) + (|> input (:coerce I64) (..and (flag idx)) (n/= 0) .not)) (do-template [<name> <main> <comp>] [(def: #export (<name> distance input) @@ -84,4 +84,4 @@ (def: #export (region size offset) (-> Nat Nat I64) - (|> |1 (:coerce I64) (left-shift size) dec (left-shift offset))) + (|> 1 (:coerce I64) (left-shift size) dec (left-shift offset))) diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index b072a808a..647eaf4b5 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -123,18 +123,14 @@ #denominator numerator}) (def: abs id) (def: (signum x) - {#numerator |1 - #denominator |1})) + {#numerator 1 + #denominator 1})) (def: separator Text ":") (def: part-encode (-> Nat Text) - (|>> nat/encode (text.split |1) maybe.assume product.right)) - -(def: part-decode - (-> Text (E.Error Nat)) - (|>> (format "+") nat/decode)) + (|>> nat/encode (text.split 1) maybe.assume product.right)) (structure: #export _ (Codec Text Ratio) (def: (encode (^slots [#numerator #denominator])) @@ -144,8 +140,8 @@ (case (text.split-with separator input) (#.Some [num denom]) (do E.Monad<Error> - [numerator (part-decode num) - denominator (part-decode denom)] + [numerator (nat/decode num) + denominator (nat/decode denom)] (wrap (normalize {#numerator numerator #denominator denominator}))) @@ -158,5 +154,5 @@ "The denominator can be omitted if it's 1." (ratio numerator))} (wrap (list (` ((~! normalize) {#..numerator (~ numerator) - #..denominator (~ (maybe.default (' |1) + #..denominator (~ (maybe.default (' 1) ?denominator))}))))) diff --git a/stdlib/source/lux/data/sum.lux b/stdlib/source/lux/data/sum.lux index 24704c3c0..edb9d19fd 100644 --- a/stdlib/source/lux/data/sum.lux +++ b/stdlib/source/lux/data/sum.lux @@ -7,8 +7,8 @@ (All [a b] (-> <type> (| a b))) (<index> value))] - [left a |0] - [right b |1]) + [left a 0] + [right b 1]) (def: #export (either fl fr) (All [a b c] @@ -16,8 +16,8 @@ (-> (| a b) c))) (function (_ input) (case input - (|0 l) (fl l) - (|1 r) (fr r)))) + (0 l) (fl l) + (1 r) (fr r)))) (def: #export (each fl fr) (All [l l' r r'] @@ -25,8 +25,8 @@ (-> (| l r) (| l' r')))) (function (_ input) (case input - (|0 l) (|0 (fl l)) - (|1 r) (|1 (fr r))))) + (0 l) (0 (fl l)) + (1 r) (1 (fr r))))) (do-template [<name> <side> <tag>] [(def: #export (<name> es) @@ -36,8 +36,8 @@ (#.Cons (<tag> x) es') (#.Cons [x (<name> es')]) (#.Cons _ es') (<name> es')))] - [lefts a |0] - [rights b |1] + [lefts a 0] + [rights b 1] ) (def: #export (partition xs) @@ -49,5 +49,5 @@ (#.Cons x xs') (let [[lefts rights] (partition xs')] (case x - (|0 x') [(#.Cons x' lefts) rights] - (|1 x') [lefts (#.Cons x' rights)])))) + (0 x') [(#.Cons x' lefts) rights] + (1 x') [lefts (#.Cons x' rights)])))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index f5462e4e7..48f35febe 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -30,7 +30,7 @@ (def: #export (index-of pattern input) (-> Text Text (Maybe Nat)) - ("lux text index" input pattern |0)) + ("lux text index" input pattern 0)) (def: (last-index-of'' part since text) (-> Text Nat Text (Maybe Nat)) @@ -52,7 +52,7 @@ (def: #export (last-index-of part text) (-> Text Text (Maybe Nat)) - (case ("lux text index" text part |0) + (case ("lux text index" text part 0) (#.Some since) (last-index-of'' part since text) @@ -62,7 +62,7 @@ (def: #export (starts-with? prefix x) (-> Text Text Bit) (case (index-of prefix x) - (#.Some |0) + (#.Some 0) #1 _ @@ -80,7 +80,7 @@ (def: #export (contains? sub text) (-> Text Text Bit) - (case ("lux text index" text sub |0) + (case ("lux text index" text sub 0) (#.Some _) #1 @@ -97,7 +97,7 @@ (def: #export (split at x) (-> Nat Text (Maybe [Text Text])) - (case [(..clip |0 at x) (..clip' at x)] + (case [(..clip 0 at x) (..clip' at x)] [(#.Some pre) (#.Some post)] (#.Some [pre post]) @@ -179,13 +179,13 @@ (:coerce Nat))} ## Platform-independent default. (let [length ("lux text size" input)] - (loop [idx |0 - hash |0] + (loop [idx 0 + hash 0] (if (n/< length idx) - (let [char (|> idx ("lux text char" input) (maybe.default |0))] + (let [char (|> idx ("lux text char" input) (maybe.default 0))] (recur (inc idx) (|> hash - (i64.left-shift |5) + (i64.left-shift 5) (n/- hash) (n/+ char)))) hash))))))) diff --git a/stdlib/source/lux/data/text/buffer.lux b/stdlib/source/lux/data/text/buffer.lux index af9d14efc..38b47e875 100644 --- a/stdlib/source/lux/data/text/buffer.lux +++ b/stdlib/source/lux/data/text/buffer.lux @@ -34,7 +34,7 @@ (def: #export empty Buffer (:abstraction (for {(~~ (static _.jvm)) - [|0 id]} + [0 id]} ## default row.empty))) @@ -59,7 +59,7 @@ ## default (row/fold (function (_ chunk total) (n/+ (//.size chunk) total)) - |0 + 0 (:representation buffer)))) (def: #export (text buffer) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 14afb4254..481d17b0a 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -15,7 +15,7 @@ (type: Offset Nat) -(def: start-offset Offset |0) +(def: start-offset Offset 0) (type: #export Lexer (p.Parser [Offset Text])) @@ -126,7 +126,7 @@ (-> Nat Nat (Lexer Text)) (do p.Monad<Parser> [char any - #let [char' (maybe.assume (text.nth |0 char))] + #let [char' (maybe.assume (text.nth 0 char))] _ (p.assert ($_ text/compose "Character is not within range: " (text.from-code bottom) "-" (text.from-code top)) (.and (n/>= bottom char') (n/<= top char')))] diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 658d51ae2..ffd937d8e 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -81,9 +81,9 @@ (def: re-range^ (l.Lexer Code) (do p.Monad<Parser> - [from (|> regex-char^ (:: @ map (|>> (text.nth |0) maybe.assume))) + [from (|> regex-char^ (:: @ map (|>> (text.nth 0) maybe.assume))) _ (l.this "-") - to (|> regex-char^ (:: @ map (|>> (text.nth |0) maybe.assume)))] + to (|> regex-char^ (:: @ map (|>> (text.nth 0) maybe.assume)))] (wrap (` (l.range (~ (code.nat from)) (~ (code.nat to))))))) (def: re-char^ @@ -288,7 +288,7 @@ #.None [(inc idx) (code.identifier ["" (int/encode idx)])]) - access (if (n/> |0 num-captures) + access (if (n/> 0 num-captures) (` ((~! product.left) (~ name!))) name!)] [idx! @@ -303,7 +303,7 @@ parts)]] (wrap [(if capturing? (list.size names) - |0) + 0) (` (do p.Monad<Parser> [(~ (' #let)) [(~ g!total) ""] (~+ (|> steps list.reverse list/join))] @@ -319,12 +319,12 @@ (function (_ input) (case (left input) (#e.Success [input' [lt lv]]) - (#e.Success [input' [lt (|0 lv)]]) + (#e.Success [input' [lt (0 lv)]]) (#e.Error _) (case (right input) (#e.Success [input' [rt rv]]) - (#e.Success [input' [rt (|1 rv)]]) + (#e.Success [input' [rt (1 rv)]]) (#e.Error error) (#e.Error error))))) @@ -346,7 +346,7 @@ (def: (prep-alternative [num-captures alt]) (-> [Nat Code] Code) - (if (n/> |0 num-captures) + (if (n/> 0 num-captures) alt (` ((~! unflatten^) (~ alt))))) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 96f16052a..011af390e 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -59,128 +59,128 @@ (do-template [<name> <start> <end>] [(def: #export <name> Segment (..segment (hex <start>) (hex <end>)))] - [basic-latin "|0000" "|007F"] - [latin-1-supplement "|00A0" "|00FF"] - [latin-extended-a "|0100" "|017F"] - [latin-extended-b "|0180" "|024F"] - [ipa-extensions "|0250" "|02AF"] - [spacing-modifier-letters "|02B0" "|02FF"] - [combining-diacritical-marks "|0300" "|036F"] - [greek-and-coptic "|0370" "|03FF"] - [cyrillic "|0400" "|04FF"] - [cyrillic-supplementary "|0500" "|052F"] - [armenian "|0530" "|058F"] - [hebrew "|0590" "|05FF"] - [arabic "|0600" "|06FF"] - [syriac "|0700" "|074F"] - [thaana "|0780" "|07BF"] - [devanagari "|0900" "|097F"] - [bengali "|0980" "|09FF"] - [gurmukhi "|0A00" "|0A7F"] - [gujarati "|0A80" "|0AFF"] - [oriya "|0B00" "|0B7F"] - [tamil "|0B80" "|0BFF"] - [telugu "|0C00" "|0C7F"] - [kannada "|0C80" "|0CFF"] - [malayalam "|0D00" "|0D7F"] - [sinhala "|0D80" "|0DFF"] - [thai "|0E00" "|0E7F"] - [lao "|0E80" "|0EFF"] - [tibetan "|0F00" "|0FFF"] - [myanmar "|1000" "|109F"] - [georgian "|10A0" "|10FF"] - [hangul-jamo "|1100" "|11FF"] - [ethiopic "|1200" "|137F"] - [cherokee "|13A0" "|13FF"] - [unified-canadian-aboriginal-syllabics "|1400" "|167F"] - [ogham "|1680" "|169F"] - [runic "|16A0" "|16FF"] - [tagalog "|1700" "|171F"] - [hanunoo "|1720" "|173F"] - [buhid "|1740" "|175F"] - [tagbanwa "|1760" "|177F"] - [khmer "|1780" "|17FF"] - [mongolian "|1800" "|18AF"] - [limbu "|1900" "|194F"] - [tai-le "|1950" "|197F"] - [khmer-symbols "|19E0" "|19FF"] - [phonetic-extensions "|1D00" "|1D7F"] - [latin-extended-additional "|1E00" "|1EFF"] - [greek-extended "|1F00" "|1FFF"] - [general-punctuation "|2000" "|206F"] - [superscripts-and-subscripts "|2070" "|209F"] - [currency-symbols "|20A0" "|20CF"] - [combining-diacritical-marks-for-symbols "|20D0" "|20FF"] - [letterlike-symbols "|2100" "|214F"] - [number-forms "|2150" "|218F"] - [arrows "|2190" "|21FF"] - [mathematical-operators "|2200" "|22FF"] - [miscellaneous-technical "|2300" "|23FF"] - [control-pictures "|2400" "|243F"] - [optical-character-recognition "|2440" "|245F"] - [enclosed-alphanumerics "|2460" "|24FF"] - [box-drawing "|2500" "|257F"] - [block-elements "|2580" "|259F"] - [geometric-shapes "|25A0" "|25FF"] - [miscellaneous-symbols "|2600" "|26FF"] - [dingbats "|2700" "|27BF"] - [miscellaneous-mathematical-symbols-a "|27C0" "|27EF"] - [supplemental-arrows-a "|27F0" "|27FF"] - [braille-patterns "|2800" "|28FF"] - [supplemental-arrows-b "|2900" "|297F"] - [miscellaneous-mathematical-symbols-b "|2980" "|29FF"] - [supplemental-mathematical-operators "|2A00" "|2AFF"] - [miscellaneous-symbols-and-arrows "|2B00" "|2BFF"] - [cjk-radicals-supplement "|2E80" "|2EFF"] - [kangxi-radicals "|2F00" "|2FDF"] - [ideographic-description-characters "|2FF0" "|2FFF"] - [cjk-symbols-and-punctuation "|3000" "|303F"] - [hiragana "|3040" "|309F"] - [katakana "|30A0" "|30FF"] - [bopomofo "|3100" "|312F"] - [hangul-compatibility-jamo "|3130" "|318F"] - [kanbun "|3190" "|319F"] - [bopomofo-extended "|31A0" "|31BF"] - [katakana-phonetic-extensions "|31F0" "|31FF"] - [enclosed-cjk-letters-and-months "|3200" "|32FF"] - [cjk-compatibility "|3300" "|33FF"] - [cjk-unified-ideographs-extension-a "|3400" "|4DBF"] - [yijing-hexagram-symbols "|4DC0" "|4DFF"] - [cjk-unified-ideographs "|4E00" "|9FFF"] - [yi-syllables "|A000" "|A48F"] - [yi-radicals "|A490" "|A4CF"] - [hangul-syllables "|AC00" "|D7AF"] - [high-surrogates "|D800" "|DB7F"] - [high-private-use-surrogates "|DB80" "|DBFF"] - [low-surrogates "|DC00" "|DFFF"] - [private-use-area "|E000" "|F8FF"] - [cjk-compatibility-ideographs "|F900" "|FAFF"] - [alphabetic-presentation-forms "|FB00" "|FB4F"] - [arabic-presentation-forms-a "|FB50" "|FDFF"] - [variation-selectors "|FE00" "|FE0F"] - [combining-half-marks "|FE20" "|FE2F"] - [cjk-compatibility-forms "|FE30" "|FE4F"] - [small-form-variants "|FE50" "|FE6F"] - [arabic-presentation-forms-b "|FE70" "|FEFF"] - [halfwidth-and-fullwidth-forms "|FF00" "|FFEF"] - [specials "|FFF0" "|FFFF"] - [linear-b-syllabary "|10000" "|1007F"] - [linear-b-ideograms "|10080" "|100FF"] - [aegean-numbers "|10100" "|1013F"] - [old-italic "|10300" "|1032F"] - [gothic "|10330" "|1034F"] - [ugaritic "|10380" "|1039F"] - [deseret "|10400" "|1044F"] - [shavian "|10450" "|1047F"] - [osmanya "|10480" "|104AF"] - [cypriot-syllabary "|10800" "|1083F"] - [byzantine-musical-symbols "|1D000" "|1D0FF"] - [musical-symbols "|1D100" "|1D1FF"] - [tai-xuan-jing-symbols "|1D300" "|1D35F"] - [mathematical-alphanumeric-symbols "|1D400" "|1D7FF"] - [cjk-unified-ideographs-extension-b "|20000" "|2A6DF"] - [cjk-compatibility-ideographs-supplement "|2F800" "|2FA1F"] - [tags "|E0000" "|E007F"] + [basic-latin "0000" "007F"] + [latin-1-supplement "00A0" "00FF"] + [latin-extended-a "0100" "017F"] + [latin-extended-b "0180" "024F"] + [ipa-extensions "0250" "02AF"] + [spacing-modifier-letters "02B0" "02FF"] + [combining-diacritical-marks "0300" "036F"] + [greek-and-coptic "0370" "03FF"] + [cyrillic "0400" "04FF"] + [cyrillic-supplementary "0500" "052F"] + [armenian "0530" "058F"] + [hebrew "0590" "05FF"] + [arabic "0600" "06FF"] + [syriac "0700" "074F"] + [thaana "0780" "07BF"] + [devanagari "0900" "097F"] + [bengali "0980" "09FF"] + [gurmukhi "0A00" "0A7F"] + [gujarati "0A80" "0AFF"] + [oriya "0B00" "0B7F"] + [tamil "0B80" "0BFF"] + [telugu "0C00" "0C7F"] + [kannada "0C80" "0CFF"] + [malayalam "0D00" "0D7F"] + [sinhala "0D80" "0DFF"] + [thai "0E00" "0E7F"] + [lao "0E80" "0EFF"] + [tibetan "0F00" "0FFF"] + [myanmar "1000" "109F"] + [georgian "10A0" "10FF"] + [hangul-jamo "1100" "11FF"] + [ethiopic "1200" "137F"] + [cherokee "13A0" "13FF"] + [unified-canadian-aboriginal-syllabics "1400" "167F"] + [ogham "1680" "169F"] + [runic "16A0" "16FF"] + [tagalog "1700" "171F"] + [hanunoo "1720" "173F"] + [buhid "1740" "175F"] + [tagbanwa "1760" "177F"] + [khmer "1780" "17FF"] + [mongolian "1800" "18AF"] + [limbu "1900" "194F"] + [tai-le "1950" "197F"] + [khmer-symbols "19E0" "19FF"] + [phonetic-extensions "1D00" "1D7F"] + [latin-extended-additional "1E00" "1EFF"] + [greek-extended "1F00" "1FFF"] + [general-punctuation "2000" "206F"] + [superscripts-and-subscripts "2070" "209F"] + [currency-symbols "20A0" "20CF"] + [combining-diacritical-marks-for-symbols "20D0" "20FF"] + [letterlike-symbols "2100" "214F"] + [number-forms "2150" "218F"] + [arrows "2190" "21FF"] + [mathematical-operators "2200" "22FF"] + [miscellaneous-technical "2300" "23FF"] + [control-pictures "2400" "243F"] + [optical-character-recognition "2440" "245F"] + [enclosed-alphanumerics "2460" "24FF"] + [box-drawing "2500" "257F"] + [block-elements "2580" "259F"] + [geometric-shapes "25A0" "25FF"] + [miscellaneous-symbols "2600" "26FF"] + [dingbats "2700" "27BF"] + [miscellaneous-mathematical-symbols-a "27C0" "27EF"] + [supplemental-arrows-a "27F0" "27FF"] + [braille-patterns "2800" "28FF"] + [supplemental-arrows-b "2900" "297F"] + [miscellaneous-mathematical-symbols-b "2980" "29FF"] + [supplemental-mathematical-operators "2A00" "2AFF"] + [miscellaneous-symbols-and-arrows "2B00" "2BFF"] + [cjk-radicals-supplement "2E80" "2EFF"] + [kangxi-radicals "2F00" "2FDF"] + [ideographic-description-characters "2FF0" "2FFF"] + [cjk-symbols-and-punctuation "3000" "303F"] + [hiragana "3040" "309F"] + [katakana "30A0" "30FF"] + [bopomofo "3100" "312F"] + [hangul-compatibility-jamo "3130" "318F"] + [kanbun "3190" "319F"] + [bopomofo-extended "31A0" "31BF"] + [katakana-phonetic-extensions "31F0" "31FF"] + [enclosed-cjk-letters-and-months "3200" "32FF"] + [cjk-compatibility "3300" "33FF"] + [cjk-unified-ideographs-extension-a "3400" "4DBF"] + [yijing-hexagram-symbols "4DC0" "4DFF"] + [cjk-unified-ideographs "4E00" "9FFF"] + [yi-syllables "A000" "A48F"] + [yi-radicals "A490" "A4CF"] + [hangul-syllables "AC00" "D7AF"] + [high-surrogates "D800" "DB7F"] + [high-private-use-surrogates "DB80" "DBFF"] + [low-surrogates "DC00" "DFFF"] + [private-use-area "E000" "F8FF"] + [cjk-compatibility-ideographs "F900" "FAFF"] + [alphabetic-presentation-forms "FB00" "FB4F"] + [arabic-presentation-forms-a "FB50" "FDFF"] + [variation-selectors "FE00" "FE0F"] + [combining-half-marks "FE20" "FE2F"] + [cjk-compatibility-forms "FE30" "FE4F"] + [small-form-variants "FE50" "FE6F"] + [arabic-presentation-forms-b "FE70" "FEFF"] + [halfwidth-and-fullwidth-forms "FF00" "FFEF"] + [specials "FFF0" "FFFF"] + [linear-b-syllabary "10000" "1007F"] + [linear-b-ideograms "10080" "100FF"] + [aegean-numbers "10100" "1013F"] + [old-italic "10300" "1032F"] + [gothic "10330" "1034F"] + [ugaritic "10380" "1039F"] + [deseret "10400" "1044F"] + [shavian "10450" "1047F"] + [osmanya "10480" "104AF"] + [cypriot-syllabary "10800" "1083F"] + [byzantine-musical-symbols "1D000" "1D0FF"] + [musical-symbols "1D100" "1D1FF"] + [tai-xuan-jing-symbols "1D300" "1D35F"] + [mathematical-alphanumeric-symbols "1D400" "1D7FF"] + [cjk-unified-ideographs-extension-b "20000" "2A6DF"] + [cjk-compatibility-ideographs-supplement "2F800" "2FA1F"] + [tags "E0000" "E007F"] ) (type: #export Set (Tree Segment [])) @@ -203,7 +203,7 @@ (..singleton (:: Monoid<Segment> compose left right)) _ - (let [[sides extra] (n//% |2 (list.size segments)) + (let [[sides extra] (n//% 2 (list.size segments)) [left+ right+] (list.split (n/+ sides extra) segments)] (finger.branch (set left+) (set right+))))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 767a4976f..5b91fc526 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1921,7 +1921,7 @@ {type (generic-type^ imports (list))} size) {#.doc (doc "Create an array of the given type, with the given size." - (array Object |10))} + (array Object 10))} (case type (^template [<type> <array-op>] (^ (#GenericClass <type> (list))) @@ -1967,7 +1967,7 @@ (syntax: #export (array-read idx array) {#.doc (doc "Loads an element from an array." - (array-read |10 my-array))} + (array-read 10 my-array))} (case array [_ (#.Identifier array-name)] (do Monad<Meta> @@ -1996,7 +1996,7 @@ (syntax: #export (array-write idx value array) {#.doc (doc "Stores an element into an array." - (array-write |10 my-object my-array))} + (array-write 10 my-object my-array))} (case array [_ (#.Identifier array-name)] (do Monad<Meta> diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index ed277b4c3..9295795be 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -21,7 +21,7 @@ "Some value...")))} (case tokens (^ (list value)) - (let [blank (: Code [["" |0 |0] (#.Identifier ["" ""])])] + (let [blank (: Code [["" 0 0] (#.Identifier ["" ""])])] (#.Right [state (list (` ([(~ blank) (~ blank)] (~ value))))])) _ diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 0de1e5772..f04503e2f 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -27,7 +27,7 @@ ## (Ann Cursor (Code' (Ann Cursor)))) ## [Utils] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) ## [Functions] (do-template [<name> <type> <tag>] diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 9be5a2ad4..135cad97e 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -153,7 +153,7 @@ (do p.Monad<Parser> [headT any] (let [members (<flattener> (type.un-name headT))] - (if (n/> |1 (list.size members)) + (if (n/> 1 (list.size members)) (local members poly) (p.fail (ex.construct <exception> headT))))))] @@ -166,7 +166,7 @@ (do p.Monad<Parser> [headT any #let [[num-arg bodyT] (type.flatten-univ-q (type.un-name headT))]] - (if (n/= |0 num-arg) + (if (n/= 0 num-arg) (p.fail (ex.construct not-polymorphic headT)) (wrap [num-arg bodyT])))) @@ -178,22 +178,22 @@ [num-args non-poly] (local (list headT) polymorphic') env ..env #let [funcL (label funcI) - [all-varsL env'] (loop [current-arg |0 + [all-varsL env'] (loop [current-arg 0 env' env all-varsL (: (List Code) (list))] (if (n/< num-args current-arg) - (if (n/= |0 current-arg) + (if (n/= 0 current-arg) (let [varL (label (inc funcI))] (recur (inc current-arg) (|> env' (dict.put funcI [headT funcL]) (dict.put (inc funcI) [(#.Parameter (inc funcI)) varL])) (#.Cons varL all-varsL))) - (let [partialI (|> current-arg (n/* |2) (n/+ funcI)) + (let [partialI (|> current-arg (n/* 2) (n/+ funcI)) partial-varI (inc partialI) partial-varL (label partial-varI) - partialC (` ((~ funcL) (~+ (|> (list.n/range |0 (dec num-args)) - (list/map (|>> (n/* |2) inc (n/+ funcI) label)) + partialC (` ((~ funcL) (~+ (|> (list.n/range 0 (dec num-args)) + (list/map (|>> (n/* 2) inc (n/+ funcI) label)) list.reverse))))] (recur (inc current-arg) (|> env' @@ -212,7 +212,7 @@ (do p.Monad<Parser> [headT any #let [[inputsT outputT] (type.flatten-function (type.un-name headT))]] - (if (n/> |0 (list.size inputsT)) + (if (n/> 0 (list.size inputsT)) (p.and (local inputsT in-poly) (local (list outputT) out-poly)) (p.fail (ex.construct not-function headT))))) @@ -222,7 +222,7 @@ (do p.Monad<Parser> [headT any #let [[funcT paramsT] (type.flatten-application (type.un-name headT))]] - (if (n/= |0 (list.size paramsT)) + (if (n/= 0 (list.size paramsT)) (p.fail (ex.construct not-application headT)) (local (#.Cons funcT paramsT) poly)))) @@ -242,10 +242,10 @@ (def: (adjusted-idx env idx) (-> Env Nat Nat) - (let [env-level (n// |2 (dict.size env)) - parameter-level (n// |2 idx) - parameter-idx (n/% |2 idx)] - (|> env-level dec (n/- parameter-level) (n/* |2) (n/+ parameter-idx)))) + (let [env-level (n// 2 (dict.size env)) + parameter-level (n// 2 idx) + parameter-idx (n/% 2 idx)] + (|> env-level dec (n/- parameter-level) (n/* 2) (n/+ parameter-idx)))) (def: #export parameter (Poly Code) @@ -323,8 +323,8 @@ headT any] (case (type.un-name headT) (^multi (#.Apply (#.Named ["lux" "Nothing"] _) (#.Parameter funcT-idx)) - (n/= |0 (adjusted-idx env funcT-idx)) - [(dict.get |0 env) (#.Some [self-type self-call])]) + (n/= 0 (adjusted-idx env funcT-idx)) + [(dict.get 0 env) (#.Some [self-type self-call])]) (wrap self-call) _ @@ -335,7 +335,7 @@ (do p.Monad<Parser> [env ..env [funcT argsT] (apply (p.and any (p.many any))) - _ (local (list funcT) (..parameter! |0)) + _ (local (list funcT) (..parameter! 0)) allC (let [allT (list& funcT argsT)] (|> allT (monad.map @ (function.constant ..parameter)) @@ -425,13 +425,13 @@ (#.Parameter idx) (let [idx (adjusted-idx env idx)] - (if (n/= |0 idx) + (if (n/= 0 idx) (|> (dict.get idx env) maybe.assume product.left (to-code env)) (` (.$ (~ (code.nat (dec idx))))))) (#.Apply (#.Named ["lux" "Nothing"] _) (#.Parameter idx)) (let [idx (adjusted-idx env idx)] - (if (n/= |0 idx) + (if (n/= 0 idx) (|> (dict.get idx env) maybe.assume product.left (to-code env)) (undefined))) diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 6f356c060..af714ed51 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -116,7 +116,7 @@ (do @ [g!eqs (poly.tuple (p.many Equivalence<?>)) #let [g!_ (code.local-identifier "_____________") - indices (|> (list.size g!eqs) dec (list.n/range |0)) + indices (|> (list.size g!eqs) dec (list.n/range 0)) g!lefts (list/map (|>> nat/encode (text/compose "left") code.local-identifier) indices) g!rights (list/map (|>> nat/encode (text/compose "right") code.local-identifier) indices)]] (wrap (` (: (~ (@Equivalence inputT)) diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index 711179404..205e78566 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -29,7 +29,7 @@ #let [num-vars (list.size varsC)] #let [@Functor (: (-> Type Code) (function (_ unwrappedT) - (if (n/= |1 num-vars) + (if (n/= 1 num-vars) (` ((~! functor.Functor) (~ (poly.to-code *env* unwrappedT)))) (let [paramsC (|> num-vars dec list.indices (list/map (|>> %n code.local-identifier)))] (` (All [(~+ paramsC)] @@ -39,7 +39,7 @@ ($_ p.either ## Type-var (do p.Monad<Parser> - [#let [varI (|> num-vars (n/* |2) dec)] + [#let [varI (|> num-vars (n/* 2) dec)] _ (poly.parameter! varI)] (wrap (` ((~ funcC) (~ valueC))))) ## Variants @@ -54,7 +54,7 @@ ## Tuples (do p.Monad<Parser> [pairsCC (: (poly.Poly (List [Code Code])) - (poly.tuple (loop [idx |0 + (poly.tuple (loop [idx 0 pairsCC (: (List [Code Code]) (list))] (p.either (let [slotC (|> idx %n (format "____________slot") code.local-identifier)] @@ -75,7 +75,7 @@ [inT+ outC] (poly.function (p.many poly.any) (Arg<?> outL)) #let [inC+ (|> (list.size inT+) dec - (list.n/range |0) + (list.n/range 0) (list/map (|>> %n (format "____________inC") code.local-identifier)))]] (wrap (` (function ((~ g!) (~+ inC+)) (let [(~ outL) ((~ valueC) (~+ inC+))] diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index b9710773a..9eabdc816 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -44,12 +44,12 @@ (function (_ input) (non-rec (rec-encode non-rec) input))) -(def: low-mask Nat (|> |1 (i64.left-shift |32) dec)) -(def: high-mask Nat (|> low-mask (i64.left-shift |32))) +(def: low-mask Nat (|> 1 (i64.left-shift 32) dec)) +(def: high-mask Nat (|> low-mask (i64.left-shift 32))) (structure: _ (Codec JSON Nat) (def: (encode input) - (let [high (|> input (i64.and high-mask) (i64.logical-right-shift |32)) + (let [high (|> input (i64.and high-mask) (i64.logical-right-shift 32)) low (i64.and low-mask input)] (#//.Array (row (|> high .int int-to-frac #//.Number) (|> low .int int-to-frac #//.Number))))) @@ -59,7 +59,7 @@ (do p.Monad<Parser> [high //.number low //.number]) - (wrap (n/+ (|> high frac-to-int .nat (i64.left-shift |32)) + (wrap (n/+ (|> high frac-to-int .nat (i64.left-shift 32)) (|> low frac-to-int .nat)))))) (structure: _ (Codec JSON Int) @@ -164,7 +164,7 @@ [g!encoders (poly.tuple (p.many Codec<JSON,?>//encode)) #let [g!_ (code.local-identifier "_______") g!members (|> (list.size g!encoders) dec - (list.n/range |0) + (list.n/range 0) (list/map (|>> nat/encode code.local-identifier)))]] (wrap (` (: (~ (@JSON//encode inputT)) (function ((~ g!_) [(~+ g!members)]) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 63eedfc9a..cdaf54461 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -88,9 +88,9 @@ (def: #export (factorial n) (-> Nat Nat) - (loop [acc |1 + (loop [acc 1 n n] - (if (n/<= |1 n) + (if (n/<= 1 n) acc (recur (n/* n acc) (dec n))))) @@ -118,7 +118,7 @@ (|> a (</> (<gcd> a b)) (<*> b)) ))] - [Nat n/mod n/gcd n/lcm |0 n/* n// n/-] + [Nat n/mod n/gcd n/lcm 0 n/* n// n/-] [Int i/mod i/gcd i/lcm +0 i/* i// i/-] ) @@ -251,7 +251,7 @@ (infix [sin [x i/+ y]]) (infix [[x n/< y] and [y n/< z]]) (infix [#and x n/< y n/< z]) - (infix [(n/* |3 |9) gcd |450]) + (infix [(n/* 3 9) gcd 450]) "The rules for infix syntax are simple." "If you want your binary function to work well with it." diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 1fc5c5476..fdbf202cf 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -88,7 +88,7 @@ (Random Bit) (function (_ prng) (let [[prng output] (prng [])] - [prng (|> output (i64.and |1) (n/= |1))]))) + [prng (|> output (i64.and 1) (n/= 1))]))) (def: #export i64 (Random I64) @@ -96,7 +96,7 @@ (let [[prng left] (prng []) [prng right] (prng [])] [prng (|> left - (i64.left-shift |32) + (i64.left-shift 32) ("lux i64 +" right))]))) (def: #export nat @@ -131,7 +131,7 @@ (def: #export (text char-gen size) (-> (Random Char) Nat (Random Text)) - (if (n/= |0 size) + (if (n/= 0 size) (:: Monad<Random> wrap "") (do Monad<Random> [x char-gen @@ -170,10 +170,10 @@ (if ? (do @ [=left left] - (wrap (|0 =left))) + (wrap (0 =left))) (do @ [=right right] - (wrap (|1 =right)))))) + (wrap (1 =right)))))) (def: #export (either left right) {#.doc "Homogeneous alternative combinator."} @@ -204,7 +204,7 @@ (do-template [<name> <type> <zero> <plus>] [(def: #export (<name> size value-gen) (All [a] (-> Nat (Random a) (Random (<type> a)))) - (if (n/> |0 size) + (if (n/> 0 size) (do Monad<Random> [x value-gen xs (<name> (dec size) value-gen)] @@ -229,7 +229,7 @@ (def: #export (set Hash<a> size value-gen) (All [a] (-> (Hash a) Nat (Random a) (Random (Set a)))) - (if (n/> |0 size) + (if (n/> 0 size) (do Monad<Random> [xs (set Hash<a> (dec size) value-gen)] (loop [_ []] @@ -243,7 +243,7 @@ (def: #export (dictionary Hash<a> size key-gen value-gen) (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) - (if (n/> |0 size) + (if (n/> 0 size) (do Monad<Random> [kv (dictionary Hash<a> (dec size) key-gen value-gen)] (loop [_ []] @@ -260,7 +260,7 @@ (All [a] (-> PRNG (Random a) [PRNG a])) (calc prng)) -(def: pcg-32-magic-mult Nat |6364136223846793005) +(def: pcg-32-magic-mult Nat 6364136223846793005) (def: #export (pcg-32 [inc seed]) {#.doc "An implementation of the PCG32 algorithm. @@ -269,11 +269,11 @@ (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(|> seed .nat (n/* pcg-32-magic-mult) ("lux i64 +" inc) [inc] pcg-32) - (let [rot (|> seed .i64 (i64.logical-right-shift |59))] + (let [rot (|> seed .i64 (i64.logical-right-shift 59))] (|> seed - (i64.logical-right-shift |18) + (i64.logical-right-shift 18) (i64.xor seed) - (i64.logical-right-shift |27) + (i64.logical-right-shift 27) (i64.rotate-right rot) .i64))])) @@ -285,10 +285,10 @@ (function (_ _) [(let [s01 (i64.xor s0 s1)] (xoroshiro-128+ [(|> s0 - (i64.rotate-left |55) + (i64.rotate-left 55) (i64.xor s01) - (i64.xor (i64.left-shift |14 s01))) - (i64.rotate-left |36 s01)])) + (i64.xor (i64.left-shift 14 s01))) + (i64.rotate-left 36 s01)])) ("lux i64 +" s0 s1)])) (def: (swap from to vec) @@ -307,7 +307,7 @@ [rand nat] (wrap (swap idx (n/% _size rand) vec)))) row - (list.n/range |0 (dec _size)))] + (list.n/range 0 (dec _size)))] (|> _shuffle - (run (pcg-32 [|123 seed])) + (run (pcg-32 [123 seed])) product.right))) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 3230ca27e..26e99fbce 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -33,12 +33,12 @@ (type: #export Test (r.Random (Promise [Counters Text]))) -(def: pcg-32-magic-inc Nat |12345) +(def: pcg-32-magic-inc Nat 12345) ## [Values] -(def: success Counters [|1 |0]) -(def: failure Counters [|0 |1]) -(def: start Counters [|0 |0]) +(def: success Counters [1 0]) +(def: failure Counters [0 1]) +(def: start Counters [0 0]) (def: (add-counters [s f] [ts tf]) (-> Counters Counters Counters) @@ -87,7 +87,7 @@ (def: failed? (-> Counters Bit) - (|>> product.right (n/> |0))) + (|>> product.right (n/> 0))) (def: #export (seed value test) (-> Seed Test Test) @@ -103,10 +103,10 @@ (def: #export (times amount test) (-> Nat Test Test) - (cond (n/= |0 amount) + (cond (n/= 0 amount) (fail "Cannot try a test 0 times.") - (n/= |1 amount) + (n/= 1 amount) test ## else @@ -167,7 +167,7 @@ "By default, random tests will be tried 100 times, you can specify the amount you want:" (context: "Addition & Substraction" - (<| (times |1234) + (<| (times 1234) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen)] @@ -177,7 +177,7 @@ "If a test fails, you'll be shown a seed that you can then use to reproduce a failing scenario." (context: "Addition & Substraction" - (<| (seed |987654321) + (<| (seed 987654321) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen)] @@ -235,8 +235,8 @@ (:: @ map list/join)))] (wrap (list (` (: (~! (IO Any)) ((~! io) (exec ((~! do) (~! promise.Monad<Promise>) - [(~' #let) [(~ g!total-successes) |0 - (~ g!total-failures) |0] + [(~' #let) [(~ g!total-successes) 0 + (~ g!total-failures) 0] (~+ (|> tests (list/map (function (_ [module-name test desc]) (` [(~ (code.text module-name)) (~ (code.identifier [module-name test])) (~ (code.text desc))]))) @@ -248,7 +248,7 @@ list/join))] (exec (log! ((~! success-message) (~ g!total-successes) (~ g!total-failures))) ((~! promise.future) - ((~! io.exit) (if (n/> |0 (~ g!total-failures)) + ((~! io.exit) (if (n/> 0 (~ g!total-failures)) +1 +0))))) []))))))))) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 688546698..b902b631f 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -57,18 +57,18 @@ (def: (month-to-nat month) (-> Month Nat) (case month - #January |0 - #February |1 - #March |2 - #April |3 - #May |4 - #June |5 - #July |6 - #August |7 - #September |8 - #October |9 - #November |10 - #December |11)) + #January 0 + #February 1 + #March 2 + #April 3 + #May 4 + #June 5 + #July 6 + #August 7 + #September 8 + #October 9 + #November 10 + #December 11)) (structure: #export _ (Order Month) (def: eq Equivalence<Month>) @@ -142,13 +142,13 @@ (def: (day-to-nat day) (-> Day Nat) (case day - #Sunday |0 - #Monday |1 - #Tuesday |2 - #Wednesday |3 - #Thursday |4 - #Friday |5 - #Saturday |6)) + #Sunday 0 + #Monday 1 + #Tuesday 2 + #Wednesday 3 + #Thursday 4 + #Friday 5 + #Saturday 6)) (structure: #export _ (Order Day) (def: eq Equivalence<Day>) @@ -246,7 +246,7 @@ (def: lex-section (l.Lexer Int) - (p.codec number.Codec<Text,Int> (l.exactly |2 l.decimal))) + (p.codec number.Codec<Text,Int> (l.exactly 2 l.decimal))) (def: (leap-years year) (-> Int Int) @@ -256,14 +256,14 @@ (def: normal-months (Row Nat) - (row |31 |28 |31 - |30 |31 |30 - |31 |31 |30 - |31 |30 |31)) + (row 31 28 31 + 30 31 30 + 31 31 30 + 31 30 31)) (def: leap-year-months (Row Nat) - (row.update [|1] inc normal-months)) + (row.update [1] inc normal-months)) (def: (divisible? factor input) (-> Int Int Bit) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 2119608e9..d6c506218 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -108,14 +108,14 @@ (def: normal-months (Row Nat) - (row |31 |28 |31 - |30 |31 |30 - |31 |31 |30 - |31 |30 |31)) + (row 31 28 31 + 30 31 30 + 31 31 30 + 31 30 31)) (def: leap-year-months (Row Nat) - (row.update [|1] inc normal-months)) + (row.update [1] inc normal-months)) (def: (find-month months time) (-> (Row Nat) duration.Duration [Nat duration.Duration]) @@ -125,14 +125,14 @@ (if (i/= +0 (duration.query month-duration time-left)) [current-month time-left] [(inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)]))) - [|0 time] + [0 time] months) (row/fold (function (_ month-days [current-month time-left]) (let [month-duration (duration.scale (.int month-days) duration.day)] (if (i/= +0 (duration.query month-duration time-left)) [current-month time-left] [(dec current-month) (duration.merge month-duration time-left)]))) - [|11 time] + [11 time] (row.reverse months)))) (def: (pad value) @@ -227,11 +227,11 @@ (def: lex-section (l.Lexer Int) - (p.codec number.Codec<Text,Int> (l.exactly |2 l.decimal))) + (p.codec number.Codec<Text,Int> (l.exactly 2 l.decimal))) (def: lex-millis (l.Lexer Int) - (p.either (|> (l.at-most |3 l.decimal) + (p.either (|> (l.at-most 3 l.decimal) (p.codec number.Codec<Text,Int>) (p.after (l.this "."))) (:: p.Monad<Parser> wrap +0))) @@ -288,7 +288,7 @@ month-days-so-far (|> months row.to-list (list.take (.nat (dec utc-month))) - (list/fold n/+ |0)) + (list/fold n/+ 0)) total-days (|> year-days-so-far (i/+ (.int month-days-so-far)) (i/+ (dec utc-day)))]] diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 851039728..5dd1e905f 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -93,7 +93,7 @@ (do-template [<name> <tag>] [(def: #export (<name> type) (-> Type [Nat Type]) - (loop [num-args |0 + (loop [num-args 0 type type] (case type (<tag> env sub-type) @@ -305,7 +305,7 @@ [(def: #export (<name> size body) (-> Nat Type Type) (case size - |0 body + 0 body _ (|> body (<name> (dec size)) (<tag> (list)))))] [univ-q #.UnivQ] @@ -333,7 +333,7 @@ (def: #export (array level elem-type) (-> Nat Type Type) (case level - |0 elem-type + 0 elem-type _ (|> elem-type (array (dec level)) (list) (#.Primitive "#Array")))) (syntax: #export (:log! {input (p.or s.identifier diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index f09b8617b..ce5ce652a 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -298,8 +298,8 @@ (def: #export fresh-context Type-Context - {#.var-counter |0 - #.ex-counter |0 + {#.var-counter 0 + #.ex-counter 0 #.var-bindings (list) }) @@ -357,7 +357,7 @@ then) (do Monad<Check> [ring (ring id) - _ (assert "" (n/> |1 (set.size ring))) + _ (assert "" (n/> 1 (set.size ring))) _ (monad.map @ (update type) (set.to-list ring))] then) (do Monad<Check> diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index fad0bfb5d..6f26a01f8 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -65,12 +65,12 @@ (find-member-type idx sig-type')) (#.Product left right) - (if (n/= |0 idx) + (if (n/= 0 idx) (:: check.Monad<Check> wrap left) (find-member-type (dec idx) right)) _ - (if (n/= |0 idx) + (if (n/= 0 idx) (:: check.Monad<Check> wrap sig-type) (check.fail (format "Cannot find member type " (%n idx) " for " (%type sig-type)))))) @@ -326,10 +326,10 @@ (::: eq.= x y) "(List Nat) equivalence" (::: = - (list.n/range |1 |10) - (list.n/range |1 |10)) + (list.n/range 1 10) + (list.n/range 1 10)) "(Functor List) map" - (::: map inc (list.n/range |0 |9)) + (::: map inc (list.n/range 0 9)) "Caveat emptor: You need to make sure to import the module of any structure you want to use." "Otherwise, this macro will not find it.")} (case args diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 0912c2482..d3f7b7ab0 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -185,7 +185,7 @@ (do p.Monad<Parser> [raw s.nat _ (p.assert (ex.construct amount-cannot-be-zero []) - (n/> |0 raw))] + (n/> 0 raw))] (wrap raw))) (do-template [<name> <m> <monad> <from> <to>] diff --git a/stdlib/source/lux/world/binary.lux b/stdlib/source/lux/world/binary.lux index 0b72af60b..a125b8067 100644 --- a/stdlib/source/lux/world/binary.lux +++ b/stdlib/source/lux/world/binary.lux @@ -30,7 +30,7 @@ (def: byte-mask I64 - (|> |1 (i64.left-shift |8) dec .i64)) + (|> 1 (i64.left-shift 8) dec .i64)) (def: i64 (-> (primitive "java.lang.Byte") I64) @@ -52,34 +52,34 @@ (def: #export (read/16 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |1 idx)) + (if (n/< (host.array-length binary) (n/+ 1 idx)) (#error.Success ($_ i64.or - (i64.left-shift |8 (..i64 (host.array-read idx binary))) - (..i64 (host.array-read (n/+ |1 idx) binary)))) + (i64.left-shift 8 (..i64 (host.array-read idx binary))) + (..i64 (host.array-read (n/+ 1 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (read/32 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |3 idx)) + (if (n/< (host.array-length binary) (n/+ 3 idx)) (#error.Success ($_ i64.or - (i64.left-shift |24 (..i64 (host.array-read idx binary))) - (i64.left-shift |16 (..i64 (host.array-read (n/+ |1 idx) binary))) - (i64.left-shift |8 (..i64 (host.array-read (n/+ |2 idx) binary))) - (..i64 (host.array-read (n/+ |3 idx) binary)))) + (i64.left-shift 24 (..i64 (host.array-read idx binary))) + (i64.left-shift 16 (..i64 (host.array-read (n/+ 1 idx) binary))) + (i64.left-shift 8 (..i64 (host.array-read (n/+ 2 idx) binary))) + (..i64 (host.array-read (n/+ 3 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (read/64 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |7 idx)) + (if (n/< (host.array-length binary) (n/+ 7 idx)) (#error.Success ($_ i64.or - (i64.left-shift |56 (..i64 (host.array-read idx binary))) - (i64.left-shift |48 (..i64 (host.array-read (n/+ |1 idx) binary))) - (i64.left-shift |40 (..i64 (host.array-read (n/+ |2 idx) binary))) - (i64.left-shift |32 (..i64 (host.array-read (n/+ |3 idx) binary))) - (i64.left-shift |24 (..i64 (host.array-read (n/+ |4 idx) binary))) - (i64.left-shift |16 (..i64 (host.array-read (n/+ |5 idx) binary))) - (i64.left-shift |8 (..i64 (host.array-read (n/+ |6 idx) binary))) - (..i64 (host.array-read (n/+ |7 idx) binary)))) + (i64.left-shift 56 (..i64 (host.array-read idx binary))) + (i64.left-shift 48 (..i64 (host.array-read (n/+ 1 idx) binary))) + (i64.left-shift 40 (..i64 (host.array-read (n/+ 2 idx) binary))) + (i64.left-shift 32 (..i64 (host.array-read (n/+ 3 idx) binary))) + (i64.left-shift 24 (..i64 (host.array-read (n/+ 4 idx) binary))) + (i64.left-shift 16 (..i64 (host.array-read (n/+ 5 idx) binary))) + (i64.left-shift 8 (..i64 (host.array-read (n/+ 6 idx) binary))) + (..i64 (host.array-read (n/+ 7 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/8 idx value binary) @@ -92,36 +92,36 @@ (def: #export (write/16 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |1 idx)) + (if (n/< (host.array-length binary) (n/+ 1 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |1 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 1 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/32 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |3 idx)) + (if (n/< (host.array-length binary) (n/+ 3 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |24 value))) - (host.array-write (n/+ |1 idx) (..byte (i64.logical-right-shift |16 value))) - (host.array-write (n/+ |2 idx) (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |3 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 24 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 16 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 3 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/64 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |7 idx)) + (if (n/< (host.array-length binary) (n/+ 7 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |56 value))) - (host.array-write (n/+ |1 idx) (..byte (i64.logical-right-shift |48 value))) - (host.array-write (n/+ |2 idx) (..byte (i64.logical-right-shift |40 value))) - (host.array-write (n/+ |3 idx) (..byte (i64.logical-right-shift |32 value))) - (host.array-write (n/+ |4 idx) (..byte (i64.logical-right-shift |24 value))) - (host.array-write (n/+ |5 idx) (..byte (i64.logical-right-shift |16 value))) - (host.array-write (n/+ |6 idx) (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |7 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 56 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 48 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 40 value))) + (host.array-write (n/+ 3 idx) (..byte (i64.logical-right-shift 32 value))) + (host.array-write (n/+ 4 idx) (..byte (i64.logical-right-shift 24 value))) + (host.array-write (n/+ 5 idx) (..byte (i64.logical-right-shift 16 value))) + (host.array-write (n/+ 6 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 7 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 893538657..e8eeb1b1b 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -58,8 +58,8 @@ [addresses (InetAddress::getAllByName [address])] (: (io.IO (e.Error InetAddress)) (case (array.size addresses) - |0 (io.io (ex.throw cannot-resolve-address address)) - |1 (wrap (maybe.assume (array.read |0 addresses))) + 0 (io.io (ex.throw cannot-resolve-address address)) + 1 (wrap (maybe.assume (array.read 0 addresses))) _ (io.io (ex.throw multiple-candidate-addresses address)))))) (abstract: #export UDP {} diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index f52b7764e..61a0299ea 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -15,9 +15,9 @@ test]) (context: "Value identity." - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) x (r.unicode size) y (r.unicode size)] ($_ seq @@ -31,14 +31,14 @@ (do-template [category rand-gen even? odd? = < >] [(context: (format "[" category "] " "Simple operations.") - (<| (times |100) + (<| (times 100) (do @ [value rand-gen] ($_ seq (test (format "[" category "] " "Moving up-down or down-up should result in same value.") (and (|> value inc dec (= value)) (|> value dec inc (= value)))) - (test (format "[" category "] " "(x|1) > x && (x-1) < x") + (test (format "[" category "] " "(x1) > x && (x-1) < x") (and (|> value inc (> value)) (|> value dec (< value)))) (test (format "[" category "] " "Every odd/even number is surrounded by two of the other kind.") @@ -54,7 +54,7 @@ (do-template [category rand-gen = < > <= >= min max] [(context: (format "[" category "] " "(More) simple operations.") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen y rand-gen] @@ -77,7 +77,7 @@ (do-template [category rand-gen = + - * / <%> > <0> <1> <factor> <cap> <prep>] [(context: (format "[" category "] " "Additive identity") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" @@ -85,7 +85,7 @@ (|> x (- <0>) (= x))))))) (context: (format "[" category "] " "Addition & Substraction") - (<| (times |100) + (<| (times 100) (do @ [x (:: @ map <prep> rand-gen) y (:: @ map <prep> rand-gen) @@ -96,7 +96,7 @@ (|> x (+ y) (- y) (= x))))))) (context: (format "[" category "] " "Multiplicative identity") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" @@ -108,7 +108,7 @@ (|> x (/ <1>) (= x)))))))) (context: (format "[" category "] " "Multiplication & Division") - (<| (times |100) + (<| (times 100) (do @ [x (:: @ map <cap> rand-gen) y (|> rand-gen @@ -125,7 +125,7 @@ (|> x' (/ y) (* y) (= x')))) ))))] - ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> |0 |1 |1_000_000 (n/% |1_000) id] + ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> 0 1 1_000_000 (n/% 1_000) id] ["Int" r.int i/= i/+ i/- i/* i// i/% i/> +0 +1 +1_000_000 (i/% +1_000) id] ["Frac" r.frac f/= f/+ f/- f/* f// f/% f/> +0.0 +1.0 +1_000_000.0 id math.floor] ["Rev" r.rev r/= r/+ r/- r/* r// r/% r/> .0 (.rev -1) (.rev -1) id id] @@ -134,11 +134,11 @@ (def: frac-rev (r.Random Rev) (|> r.rev - (:: r.Functor<Random> map (|>> (i64.left-shift |11) (i64.logical-right-shift |11))))) + (:: r.Functor<Random> map (|>> (i64.left-shift 11) (i64.logical-right-shift 11))))) (do-template [category rand-gen -> <- = <cap>] [(context: (format "[" category "] " "Numeric conversions") - (<| (times |100) + (<| (times 100) (do @ [value rand-gen #let [value (<cap> value)]] @@ -146,7 +146,7 @@ (|> value -> <- (= value))))))] ["Int->Nat" r.int .nat .int i/= (i/% +1_000_000)] - ["Nat->Int" r.nat .int .nat n/= (n/% |1_000_000)] + ["Nat->Int" r.nat .int .nat n/= (n/% 1_000_000)] ["Int->Frac" r.int int-to-frac frac-to-int i/= (i/% +1_000_000)] ["Frac->Int" r.frac frac-to-int int-to-frac f/= math.floor] ["Rev->Frac" frac-rev rev-to-frac frac-to-rev r/= id] @@ -189,7 +189,7 @@ (i/+ (i/* x x) (i/* y y))) (context: "Templates." - (<| (times |100) + (<| (times 100) (do @ [x r.int y r.int] diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index c5b3a485c..501c62df4 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -17,16 +17,16 @@ lux/test) (context: "CLI" - (<| (times |100) + (<| (times 100) (do @ - [num-args (|> r.nat (:: @ map (n/% |10))) + [num-args (|> r.nat (:: @ map (n/% 10))) #let [(^open "Nat/.") number.Codec<Text,Nat> gen-arg (:: @ map Nat/encode r.nat)] yes gen-arg - #let [gen-ignore (|> (r.unicode |5) (r.filter (|>> (text/= yes) not)))] + #let [gen-ignore (|> (r.unicode 5) (r.filter (|>> (text/= yes) not)))] no gen-ignore - pre-ignore (r.list |5 gen-ignore) - post-ignore (r.list |5 gen-ignore)] + pre-ignore (r.list 5 gen-ignore) + post-ignore (r.list 5 gen-ignore)] ($_ seq (test "Can read any argument." (|> (/.run (list yes) /.any) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux index 4a1b1e28e..abe199241 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/case.lux @@ -67,7 +67,7 @@ [#.Int r.int code.int] [#.Rev r.rev code.rev] [#.Frac r.frac code.frac] - [#.Text (r.unicode |5) code.text]) + [#.Text (r.unicode 5) code.text]) (^ [_ (#.Tuple (list))]) (random/wrap (list (' []))) @@ -118,7 +118,7 @@ choiceC (maybe.assume (list.nth choice primitivesC))]] (wrap (` ((~ choiceT) (~ choiceC))))) (do r.Monad<Random> - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) elems (r.list size input)] (wrap (code.tuple elems))) (random/wrap (code.record (list.zip2 record-tags primitivesC))) @@ -129,17 +129,17 @@ [pattern body]) (context: "Pattern-matching." - ## #seed |9253409297339902486 - ## #seed |3793366152923578600 - (<| (seed |5004137551292836565) - ## (times |100) + ## #seed 9253409297339902486 + ## #seed 3793366152923578600 + (<| (seed 5004137551292836565) + ## (times 100) (do @ - [module-name (r.unicode |5) - variant-name (r.unicode |5) - record-name (|> (r.unicode |5) (r.filter (|>> (text/= variant-name) not))) - size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - variant-tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) - record-tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [module-name (r.unicode 5) + variant-name (r.unicode 5) + record-name (|> (r.unicode 5) (r.filter (|>> (text/= variant-name) not))) + size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + variant-tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) + record-tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) primitivesTC (r.list size _primitive.primitive) #let [primitivesT (list/map product.left primitivesTC) primitivesC (list/map product.right primitivesTC) @@ -178,7 +178,7 @@ _ (module.declare-tags record-tags #0 (#.Named [module-name record-name] (type.tuple primitivesT)))]) - (module.with-module |0 module-name))]] + (module.with-module 0 module-name))]] ($_ seq (test "Will reject empty pattern-matching (no branches)." (|> (analyse-pm (list)) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux index 11220052f..ba84d926f 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux @@ -47,10 +47,10 @@ #0))) (context: "Function definition." - (<| (times |100) + (<| (times 100) (do @ - [func-name (r.unicode |5) - arg-name (|> (r.unicode |5) (r.filter (|>> (text/= func-name) not))) + [func-name (r.unicode 5) + arg-name (|> (r.unicode 5) (r.filter (|>> (text/= func-name) not))) [outputT outputC] _primitive.primitive [inputT _] _primitive.primitive #let [g!arg (code.local-identifier arg-name)]] @@ -76,19 +76,19 @@ )))) (context: "Function application." - (<| (times |100) + (<| (times 100) (do @ - [full-args (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [full-args (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) partial-args (|> r.nat (:: @ map (n/% full-args))) - var-idx (|> r.nat (:: @ map (|>> (n/% full-args) (n/max |1)))) + var-idx (|> r.nat (:: @ map (|>> (n/% full-args) (n/max 1)))) inputsTC (r.list full-args _primitive.primitive) #let [inputsT (list/map product.left inputsTC) inputsC (list/map product.right inputsTC)] [outputT outputC] _primitive.primitive #let [funcT (type.function inputsT outputT) partialT (type.function (list.drop partial-args inputsT) outputT) - varT (#.Parameter |1) - polyT (<| (type.univ-q |1) + varT (#.Parameter 1) + polyT (<| (type.univ-q 1) (type.function (list.concat (list (list.take var-idx inputsT) (list varT) (list.drop (inc var-idx) inputsT)))) @@ -97,10 +97,10 @@ partial-poly-inputsT (list.drop (inc var-idx) inputsT) partial-polyT1 (<| (type.function partial-poly-inputsT) poly-inputT) - partial-polyT2 (<| (type.univ-q |1) + partial-polyT2 (<| (type.univ-q 1) (type.function (#.Cons varT partial-poly-inputsT)) varT) - dummy-function (#analysis.Function (list) (#analysis.Reference (reference.local |1)))]] + dummy-function (#analysis.Function (list) (#analysis.Reference (reference.local 1)))]] ($_ seq (test "Can analyse monomorphic type application." (|> (/.apply ..analyse funcT dummy-function inputsC) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux index b6bec104f..1d807e519 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/primitive.lux @@ -36,13 +36,13 @@ (~~ (do-template [<type> <code-wrapper> <value-gen>] [(r.and (random/wrap <type>) (random/map <code-wrapper> <value-gen>))] - [Any code.tuple (r.list |0 ..unit)] + [Any code.tuple (r.list 0 ..unit)] [Bit code.bit r.bit] [Nat code.nat r.nat] [Int code.int r.int] [Rev code.rev r.rev] [Frac code.frac r.frac] - [Text code.text (r.unicode |5)] + [Text code.text (r.unicode 5)] ))))) (exception: (wrong-inference {expected Type} {inferred Type}) @@ -71,7 +71,7 @@ _ #0))) - (<| (times |100) + (<| (times 100) (`` ($_ seq (~~ (do-template [<desc> <type> <tag> <random> <constructor>] [(do @ @@ -89,5 +89,5 @@ ["int" Int #analysis.Int r.int code.int] ["rev" Rev #analysis.Rev r.rev code.rev] ["frac" Frac #analysis.Frac r.frac code.frac] - ["text" Text #analysis.Text (r.unicode |5) code.text] + ["text" Text #analysis.Text (r.unicode 5) code.text] ))))))) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux index f13db8218..5fc04278b 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux @@ -47,7 +47,7 @@ ) (context: "Lux procedures" - (<| (times |100) + (<| (times 100) (do @ [[primT primC] _primitive.primitive [antiT antiC] (|> _primitive.primitive @@ -64,7 +64,7 @@ )))) (context: "Bit procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.nat (:: @ map code.nat)) signedC (|> r.int (:: @ map code.int)) @@ -85,7 +85,7 @@ )))) (context: "Int procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.int (:: @ map code.int)) paramC (|> r.int (:: @ map code.int))] @@ -111,11 +111,11 @@ )))) (context: "Frac procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.frac (:: @ map code.frac)) paramC (|> r.frac (:: @ map code.frac)) - encodedC (|> (r.unicode |5) (:: @ map code.text))] + encodedC (|> (r.unicode 5) (:: @ map code.text))] ($_ seq (test "Can add frac numbers." (check-success+ "lux frac +" (list subjectC paramC) Frac)) @@ -146,11 +146,11 @@ )))) (context: "Text procedures" - (<| (times |100) + (<| (times 100) (do @ - [subjectC (|> (r.unicode |5) (:: @ map code.text)) - paramC (|> (r.unicode |5) (:: @ map code.text)) - replacementC (|> (r.unicode |5) (:: @ map code.text)) + [subjectC (|> (r.unicode 5) (:: @ map code.text)) + paramC (|> (r.unicode 5) (:: @ map code.text)) + replacementC (|> (r.unicode 5) (:: @ map code.text)) fromC (|> r.nat (:: @ map code.nat)) toC (|> r.nat (:: @ map code.nat))] ($_ seq @@ -171,12 +171,12 @@ )))) (context: "Array procedures" - (<| (times |100) + (<| (times 100) (do @ [[elemT elemC] _primitive.primitive sizeC (|> r.nat (:: @ map code.nat)) idxC (|> r.nat (:: @ map code.nat)) - var-name (r.unicode |5) + var-name (r.unicode 5) #let [arrayT (type (Array elemT)) g!array (code.local-identifier var-name) array-operation (function (_ output-type code) @@ -208,7 +208,7 @@ )))) (context: "Math procedures" - (<| (times |100) + (<| (times 100) (do @ [subjectC (|> r.frac (:: @ map code.frac)) paramC (|> r.frac (:: @ map code.frac))] @@ -239,12 +239,12 @@ ["lux math pow" "power"]))))))) (context: "Atom procedures" - (<| (times |100) + (<| (times 100) (do @ [[elemT elemC] _primitive.primitive sizeC (|> r.nat (:: @ map code.nat)) idxC (|> r.nat (:: @ map code.nat)) - var-name (r.unicode |5) + var-name (r.unicode 5) #let [atomT (type (atom.Atom elemT))]] ($_ seq (test "Can create atomic reference." @@ -277,7 +277,7 @@ )))) (context: "Process procedures" - (<| (times |100) + (<| (times 100) (do @ [[primT primC] _primitive.primitive timeC (|> r.nat (:: @ map code.nat))] @@ -292,9 +292,9 @@ )))) (context: "IO procedures" - (<| (times |100) + (<| (times 100) (do @ - [logC (|> (r.unicode |5) (:: @ map code.text)) + [logC (|> (r.unicode 5) (:: @ map code.text)) exitC (|> r.int (:: @ map code.int))] ($_ seq (test "Can log messages to standard output." diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux index 55a673935..dae6d916b 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux @@ -48,13 +48,13 @@ (def: (reach-test var-name [export? def-module] [import? dependent-module] check!) (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do phase.Monad<Operation> - [_ (module.with-module |0 def-module + [_ (module.with-module 0 def-module (module.define var-name [Any (if export? (' {#.export? #1}) (' {})) []]))] - (module.with-module |0 dependent-module + (module.with-module 0 dependent-module (do @ [_ (if import? (module.import def-module) @@ -65,13 +65,13 @@ check!)) (context: "References" - (<| (times |100) + (<| (times 100) (do @ [[expectedT _] _primitive.primitive - def-module (r.unicode |5) - scope-name (r.unicode |5) - var-name (r.unicode |5) - dependent-module (|> (r.unicode |5) + def-module (r.unicode 5) + scope-name (r.unicode 5) + var-name (r.unicode 5) + dependent-module (|> (r.unicode 5) (r.filter (|>> (text/= def-module) not)))] ($_ seq (test "Can analyse variable." @@ -82,7 +82,7 @@ (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [inferredT (#analysis.Reference (reference.local var))])) (and (type/= expectedT inferredT) - (n/= |0 var)) + (n/= 0 var)) _ #0))) @@ -92,7 +92,7 @@ [_ (module.define var-name [expectedT (' {}) []])] (typeA.with-inference (..analyse (code.identifier def-name)))) - (module.with-module |0 def-module) + (module.with-module 0 def-module) (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [_ inferredT (#analysis.Reference (reference.constant constant-name))])) (and (type/= expectedT inferredT) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux index 1b23587f7..d36bffe20 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/structure.lux @@ -75,7 +75,7 @@ (All [a] (-> Text (List module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do phase.Monad<Operation> [_ (module.declare-tags tags #0 type)]) - (module.with-module |0 module))) + (module.with-module 0 module))) (def: (check-variant module tags type size tag analysis) (-> Text (List module.Tag) Type Nat Tag (Operation Analysis) Bit) @@ -108,9 +108,9 @@ #0))) (context: "Sums" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) choice (|> r.nat (:: @ map (n/% size))) primitives (r.list size _primitive.primitive) +choice (|> r.nat (:: @ map (n/% (inc size)))) @@ -119,7 +119,7 @@ [valueT valueC] (maybe.assume (list.nth choice primitives)) +size (inc size) +primitives (list.concat (list (list.take choice primitives) - (list [(#.Parameter |1) +valueC]) + (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) [+valueT +valueC] (maybe.assume (list.nth +choice +primitives)) +variantT (type.variant (list/map product.left +primitives))]] @@ -149,29 +149,29 @@ (/.sum ..analyse choice valueC))) check-fails)) (test "Can analyse sum through existential quantification." - (|> (typeA.with-type (type.ex-q |1 +variantT) + (|> (typeA.with-type (type.ex-q 1 +variantT) (/.sum ..analyse +choice +valueC)) check-succeeds)) (test "Can analyse sum through universal quantification." (let [check-outcome (if (not (n/= choice +choice)) check-succeeds check-fails)] - (|> (typeA.with-type (type.univ-q |1 +variantT) + (|> (typeA.with-type (type.univ-q 1 +variantT) (/.sum ..analyse +choice +valueC)) check-outcome))) )))) (context: "Products" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) primitives (r.list size _primitive.primitive) choice (|> r.nat (:: @ map (n/% size))) [_ +valueC] _primitive.primitive #let [tupleT (type.tuple (list/map product.left primitives)) [singletonT singletonC] (|> primitives (list.nth choice) maybe.assume) +primitives (list.concat (list (list.take choice primitives) - (list [(#.Parameter |1) +valueC]) + (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) +tupleT (type.tuple (list/map product.left +primitives))]] ($_ seq @@ -212,26 +212,26 @@ _ #0))) (test "Can analyse product through existential quantification." - (|> (typeA.with-type (type.ex-q |1 +tupleT) + (|> (typeA.with-type (type.ex-q 1 +tupleT) (/.product ..analyse (list/map product.right +primitives))) check-succeeds)) (test "Cannot analyse product through universal quantification." - (|> (typeA.with-type (type.univ-q |1 +tupleT) + (|> (typeA.with-type (type.univ-q 1 +tupleT) (/.product ..analyse (list/map product.right +primitives))) check-fails)) )))) (context: "Tagged Sums" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) choice (|> r.nat (:: @ map (n/% size))) other-choice (|> r.nat (:: @ map (n/% size)) (r.filter (|>> (n/= choice) not))) primitives (r.list size _primitive.primitive) - module-name (r.unicode |5) - type-name (r.unicode |5) - #let [varT (#.Parameter |1) + module-name (r.unicode 5) + type-name (r.unicode 5) + #let [varT (#.Parameter 1) primitivesT (list/map product.left primitives) [choiceT choiceC] (maybe.assume (list.nth choice primitives)) [other-choiceT other-choiceC] (maybe.assume (list.nth other-choice primitives)) @@ -240,7 +240,7 @@ named-polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q |1) + (type.univ-q 1) (#.Named [module-name type-name])) choice-tag (maybe.assume (list.nth choice tags)) other-choice-tag (maybe.assume (list.nth other-choice tags))]] @@ -261,15 +261,15 @@ )))) (context: "Records" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) - tags (|> (r.set text.Hash<Text> size (r.unicode |5)) (:: @ map set.to-list)) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) + tags (|> (r.set text.Hash<Text> size (r.unicode 5)) (:: @ map set.to-list)) primitives (r.list size _primitive.primitive) - module-name (r.unicode |5) - type-name (r.unicode |5) + module-name (r.unicode 5) + type-name (r.unicode 5) choice (|> r.nat (:: @ map (n/% size))) - #let [varT (#.Parameter |1) + #let [varT (#.Parameter 1) tagsC (list/map (|>> [module-name] code.tag) tags) primitivesT (list/map product.left primitives) primitivesC (list/map product.right primitives) @@ -279,7 +279,7 @@ named-polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q |1) + (type.univ-q 1) (#.Named [module-name type-name]))]] ($_ seq (test "Can infer record." diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux index 43c58f446..f3c3b9d2e 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/case.lux @@ -20,10 +20,10 @@ ["." //primitive]) (context: "Dummy variables." - (<| (times |100) + (<| (times 100) (do @ [maskedA //primitive.primitive - temp (|> r.nat (:: @ map (n/% |100))) + temp (|> r.nat (:: @ map (n/% 100))) #let [maskA (analysis.control/case [maskedA [[(#analysis.Bind temp) @@ -37,7 +37,7 @@ (error.default #0)))))) (context: "Let expressions." - (<| (times |100) + (<| (times 100) (do @ [registerA r.nat inputA //primitive.primitive @@ -60,7 +60,7 @@ #0)))))) (context: "If expressions." - (<| (times |100) + (<| (times 100) (do @ [then|else r.bit inputA //primitive.primitive diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux index 046eef852..fae0e0fdf 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/function.lux @@ -42,7 +42,7 @@ predictionA])) (do @ [predictionA //primitive.primitive] - (wrap [|0 predictionA predictionA]))))))) + (wrap [0 predictionA predictionA]))))))) (def: (pick scope-size) (-> Nat (r.Random Nat)) @@ -51,12 +51,12 @@ (def: function-with-environment (r.Random [Arity Analysis Variable]) (do r.Monad<Random> - [num-locals (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) - #let [indices (list.n/range |0 (dec num-locals)) + [num-locals (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) + #let [indices (list.n/range 0 (dec num-locals)) local-env (list/map (|>> #reference.Local) indices) foreign-env (list/map (|>> #reference.Foreign) indices)] [arity bodyA predictionA] (: (r.Random [Arity Analysis Variable]) - (loop [arity |1 + (loop [arity 1 current-env foreign-env] (let [current-env/size (list.size current-env) resolver (list/fold (function (_ [idx var] resolver) @@ -68,7 +68,7 @@ [nest? r.bit] (if nest? (do @ - [num-picks (:: @ map (n/max |1) (pick (inc current-env/size))) + [num-picks (:: @ map (n/max 1) (pick (inc current-env/size))) picks (|> (r.set number.Hash<Nat> num-picks (pick current-env/size)) (:: @ map set.to-list)) [arity bodyA predictionA] (recur (inc arity) @@ -90,7 +90,7 @@ (def: local-function (r.Random [Arity Analysis Variable]) - (loop [arity |0 + (loop [arity 0 nest? #1] (if nest? (do r.Monad<Random> @@ -100,14 +100,14 @@ (#analysis.Function (list) bodyA) predictionA])) (do r.Monad<Random> - [chosen (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2))))] + [chosen (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2))))] (wrap [arity (#analysis.Reference (reference.local chosen)) (|> chosen (n/+ (dec arity)) #reference.Local)]))))) (context: "Function definition." - (<| (seed |13007429814532219492) - ## (times |100) + (<| (seed 13007429814532219492) + ## (times 100) (do @ [[arity//constant function//constant prediction//constant] constant-function [arity//environment function//environment prediction//environment] function-with-environment @@ -122,7 +122,7 @@ (//primitive.corresponds? prediction//constant output)) _ - (n/= |0 arity//constant)))) + (n/= 0 arity//constant)))) (test "Folded functions provide direct access to environment variables." (|> function//environment expression.synthesize @@ -146,9 +146,9 @@ )))) (context: "Function application." - (<| (times |100) + (<| (times 100) (do @ - [arity (|> r.nat (:: @ map (|>> (n/% |10) (n/max |1)))) + [arity (|> r.nat (:: @ map (|>> (n/% 10) (n/max 1)))) funcA //primitive.primitive argsA (r.list arity //primitive.primitive)] ($_ seq diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux index e2fa45521..9587919a2 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/primitive.lux @@ -30,7 +30,7 @@ r.int r.rev r.frac - (r.unicode |5)))] + (r.unicode 5)))] (wrap (#analysis.Primitive primitive)))) (def: #export (corresponds? analysis synthesis) @@ -68,14 +68,14 @@ #0)) (context: "Primitives." - (<| (times |100) + (<| (times 100) (do @ [|bit| r.bit |nat| r.nat |int| r.int |rev| r.rev |frac| r.frac - |text| (r.unicode |5)] + |text| (r.unicode 5)] (`` ($_ seq (~~ (do-template [<desc> <analysis> <synthesis> <sample>] [(test (format "Can synthesize " <desc> ".") diff --git a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux index b3363567a..90fd155b0 100644 --- a/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux +++ b/stdlib/test/test/lux/compiler/default/phase/synthesis/structure.lux @@ -23,9 +23,9 @@ ["." //primitive]) (context: "Variants" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/+ |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/+ 2)))) tagA (|> r.nat (:: @ map (n/% size))) memberA //primitive.primitive] ($_ seq @@ -44,9 +44,9 @@ )))) (context: "Tuples" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |10) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 10) (n/max 2)))) membersA (r.list size //primitive.primitive)] ($_ seq (test "Can synthesize tuple." diff --git a/stdlib/test/test/lux/compiler/default/syntax.lux b/stdlib/test/test/lux/compiler/default/syntax.lux index 5bd7c09d8..e52a6ea02 100644 --- a/stdlib/test/test/lux/compiler/default/syntax.lux +++ b/stdlib/test/test/lux/compiler/default/syntax.lux @@ -23,8 +23,8 @@ (def: default-cursor Cursor {#.module "" - #.line |0 - #.column |0}) + #.line 0 + #.column 0}) (def: name-part^ (r.Random Text) @@ -34,11 +34,11 @@ space "\t\v \n\r\f" invalid-range (format digits delimiters space) char-gen (|> r.nat - (:: @ map (|>> (n/% |256) (n/max |1))) + (:: @ map (|>> (n/% 256) (n/max 1))) (r.filter (function (_ sample) (not (text.contains? (text.from-code sample) invalid-range)))))] - size (|> r.nat (:: @ map (|>> (n/% |20) (n/max |1))))] + size (|> r.nat (:: @ map (|>> (n/% 20) (n/max 1))))] (r.text char-gen size))) (def: name^ @@ -57,7 +57,7 @@ textual^ (: (r.Random Code) ($_ r.either (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |20)))] + [size (|> r.nat (r/map (n/% 20)))] (|> (r.unicode size) (r/map code.text))) (|> name^ (r/map code.identifier)) (|> name^ (r/map code.tag)))) @@ -68,28 +68,28 @@ (r.rec (function (_ code^) (let [multi^ (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |3)))] + [size (|> r.nat (r/map (n/% 3)))] (r.list size code^)) composite^ (: (r.Random Code) ($_ r.either (|> multi^ (r/map code.form)) (|> multi^ (r/map code.tuple)) (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |3)))] + [size (|> r.nat (r/map (n/% 3)))] (|> (r.list size (r.and code^ code^)) (r/map code.record)))))] (r.either simple^ composite^)))))) (context: "Lux code syntax." - (<| (times |100) + (<| (times 100) (do @ [sample code^ other code^] ($_ seq (test "Can parse Lux code." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 (code.to-text sample)]) + [default-cursor 0 (code.to-text sample)]) (#e.Error error) #0 @@ -97,8 +97,8 @@ (:: code.Equivalence<Code> = parsed sample))) (test "Can parse Lux multiple code nodes." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 (format (code.to-text sample) " " - (code.to-text other))]) + [default-cursor 0 (format (code.to-text sample) " " + (code.to-text other))]) (#e.Error error) #0 @@ -114,15 +114,15 @@ )))) (context: "Frac special syntax." - (<| (times |100) + (<| (times 100) (do @ - [numerator (|> r.nat (:: @ map (|>> (n/% |100) .int int-to-frac))) - denominator (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1) .int int-to-frac))) + [numerator (|> r.nat (:: @ map (|>> (n/% 100) .int int-to-frac))) + denominator (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1) .int int-to-frac))) signed? r.bit #let [expected (|> numerator (f// denominator) (f/* (if signed? -1.0 +1.0)))]] (test "Can parse frac ratio syntax." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format (if signed? "-" "") (%i (frac-to-int numerator)) "/" @@ -135,12 +135,12 @@ )))) (context: "Nat special syntax." - (<| (times |100) + (<| (times 100) (do @ - [expected (|> r.nat (:: @ map (n/% |1_000)))] + [expected (|> r.nat (:: @ map (n/% 1_000)))] (test "Can parse nat char syntax." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#" (%t (text.from-code expected)) "")]) (#e.Success [_ [_ (#.Nat actual)]]) (n/= expected actual) @@ -157,7 +157,7 @@ (n/= (char "(") value) (n/= (char ")") value))))))] (do r.Monad<Random> - [size (|> r.nat (r/map (n/% |20)))] + [size (|> r.nat (r/map (n/% 20)))] (r.text char-gen size)))) (def: comment^ @@ -172,8 +172,8 @@ (wrap (format "#( " comment " )#"))))))) (context: "Multi-line text & comments." - (<| (seed |12137892244981970631) - ## (times |100) + (<| (seed 12137892244981970631) + ## (times 100) (do @ [#let [char-gen (|> r.nat (r.filter (function (_ value) (not (or (text.space? value) @@ -181,7 +181,7 @@ x char-gen y char-gen z char-gen - offset-size (|> r.nat (r/map (|>> (n/% |10) (n/max |1)))) + offset-size (|> r.nat (r/map (|>> (n/% 10) (n/max 1)))) #let [offset (text.join-with "" (list.repeat offset-size " "))] sample code^ comment comment^ @@ -192,7 +192,7 @@ (text.from-code y) "\n" (text.from-code z))] (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "\"" bad-match "\"")]) (#e.Error error) #1 @@ -208,7 +208,7 @@ (text.from-code z))] (case (&.read "" (dict.new text.Hash<Text>) [(|> default-cursor (update@ #.column (n/+ (dec offset-size)))) - |0 + 0 (format "\"" good-input "\"")]) (#e.Error error) #0 @@ -219,7 +219,7 @@ (code.text good-output))))) (test "Can handle comments." (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format comment (code.to-text sample))]) (#e.Error error) #0 @@ -228,7 +228,7 @@ (:: code.Equivalence<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." (and (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#(" "#(" unbalanced-comment ")#" (code.to-text sample))]) (#e.Error error) @@ -237,7 +237,7 @@ (#e.Success [_ parsed]) #0) (case (&.read "" (dict.new text.Hash<Text>) - [default-cursor |0 + [default-cursor 0 (format "#(" unbalanced-comment ")#" ")#" (code.to-text sample))]) (#e.Error error) diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index 42b2f5412..a43845380 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -38,19 +38,19 @@ ($_ seq (test "Can check if an actor is alive." (io.run (do io.Monad<IO> - [counter (new@Counter |0)] + [counter (new@Counter 0)] (wrap (&.alive? counter))))) (test "Can poison actors." (io.run (do io.Monad<IO> - [counter (new@Counter |0) + [counter (new@Counter 0) poisoned? (&.poison counter)] (wrap (and poisoned? (not (&.alive? counter))))))) (test "Cannot poison an already dead actor." (io.run (do io.Monad<IO> - [counter (new@Counter |0) + [counter (new@Counter 0) first-time (&.poison counter) second-time (&.poison counter)] (wrap (and first-time @@ -58,13 +58,13 @@ (wrap (do P.Monad<Promise> [result (do T.Monad<Task> - [#let [counter (io.run (new@Counter |0))] - output-1 (count! |1 counter) - output-2 (count! |1 counter) - output-3 (count! |1 counter)] - (wrap (and (n/= |1 output-1) - (n/= |2 output-2) - (n/= |3 output-3))))] + [#let [counter (io.run (new@Counter 0))] + output-1 (count! 1 counter) + output-2 (count! 1 counter) + output-3 (count! 1 counter)] + (wrap (and (n/= 1 output-1) + (n/= 2 output-2) + (n/= 3 output-3))))] (assert "Can send messages to actors." (case result (#e.Success outcome) diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index db480b27e..a10edcae7 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -10,7 +10,7 @@ lux/test) (context: "Atoms" - (<| (times |100) + (<| (times 100) (do @ [value r.nat swap-value r.nat diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 7ba1a80e9..46db40889 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -42,7 +42,7 @@ output (read! input) _ (write! values input)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can pipe one channel into another." (list/= values @@ -56,7 +56,7 @@ output (read! elems) _ (write! (list +0 +1 +2 +3 +4 +5) input)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can filter a channel's elements." (list/= (list +0 +2 +4) @@ -72,7 +72,7 @@ _ (write! (list +0 +1 +2 +3 +4 +5) left) _ (write! (list +0 -1 -2 -3 -4 -5) right)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Can merge channels." (list/= (list +0 +1 +2 +3 +4 +5 +0 -1 -2 -3 -4 -5) @@ -86,7 +86,7 @@ output (read! mapped) _ (write! (list +0 +1 +2 +3 +4 +5) inputs)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Functor goes over every element in a channel." (list/= (list +1 +2 +3 +4 +5 +6) @@ -102,7 +102,7 @@ _ (write! (list inc) >f<) _ (write! (list +12345) >a<)] (wrap output))) - _ (promise.wait |100) + _ (promise.wait 100) output (promise.future (atom.read output))] (assert "Apply works over all channel values." (list/= (list +12346) @@ -111,10 +111,10 @@ (wrap (do promise.Monad<Promise> [output (promise.future (read! (do frp.Monad<Channel> - [f (frp.from-promise (promise.delay |100 inc)) - a (frp.from-promise (promise.delay |200 +12345))] - (frp.from-promise (promise.delay |300 (f a)))))) - _ (promise.wait |700) + [f (frp.from-promise (promise.delay 100 inc)) + a (frp.from-promise (promise.delay 200 +12345))] + (frp.from-promise (promise.delay 300 (f a)))))) + _ (promise.wait 700) output (promise.future (atom.read output))] (assert "Valid monad." (list/= (list +12346) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 749adf802..e857d0708 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -18,7 +18,7 @@ running?))) (wrap (do &.Monad<Promise> - [_ (&.wait |500)] + [_ (&.wait 500)] (assert "Can wait for a specified amount of time." #1))) @@ -29,10 +29,10 @@ (and left (not right))))) (wrap (do &.Monad<Promise> - [?left (&.or (&.delay |100 #1) - (&.delay |200 #0)) - ?right (&.or (&.delay |200 #1) - (&.delay |100 #0))] + [?left (&.or (&.delay 100 #1) + (&.delay 200 #0)) + ?right (&.or (&.delay 200 #1) + (&.delay 100 #0))] (assert "Can combine promises alternatively." (case [?left ?right] [(#.Left #1) (#.Right #0)] @@ -42,17 +42,17 @@ #0)))) (wrap (do &.Monad<Promise> - [?left (&.either (&.delay |100 #1) - (&.delay |200 #0)) - ?right (&.either (&.delay |200 #1) - (&.delay |100 #0))] + [?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 #1)) (case> (#.Some #1) #1 _ #0)) - (|> (&.poll (&.delay |200 #1)) + (|> (&.poll (&.delay 200 #1)) (case> #.None #1 _ #0)))) (test "Cannot re-resolve a resolved promise." @@ -60,8 +60,8 @@ (io.run (&.resolve #1 (: (&.Promise Bit) (&.promise #.None)))))) (wrap (do &.Monad<Promise> - [?none (&.time-out |100 (&.delay |200 #1)) - ?some (&.time-out |200 (&.delay |100 #1))] + [?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 #1)] diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index 73ee3f8af..f309fcd0c 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -20,16 +20,16 @@ (def: (wait-many-times times semaphore) (-> Nat /.Semaphore (Promise Any)) (loop [steps times] - (if (n/> |0 steps) + (if (n/> 0 steps) (do promise.Monad<Promise> [_ (/.wait semaphore)] (recur (dec steps))) (:: promise.Monad<Promise> wrap [])))) (context: "Semaphore." - (<| (times |100) + (<| (times 100) (do @ - [open-positions (|> r.nat (:: @ map (|>> (n/% |10) (n/max |1))))] + [open-positions (|> r.nat (:: @ map (|>> (n/% 10) (n/max 1))))] ($_ seq (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> @@ -38,7 +38,7 @@ #1)))) (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> - [result (<| (promise.time-out |100) + [result (<| (promise.time-out 100) (wait-many-times (inc open-positions) semaphore))] (assert "Waiting on a semaphore more than the number of open positions blocks the process." (case result @@ -50,8 +50,8 @@ (let [semaphore (/.semaphore open-positions)] (wrap (do promise.Monad<Promise> [_ (: (Promise Any) - (loop [steps (n/* |2 open-positions)] - (if (n/> |0 steps) + (loop [steps (n/* 2 open-positions)] + (if (n/> 0 steps) (do @ [_ (/.wait semaphore) _ (/.signal semaphore)] @@ -68,7 +68,7 @@ #let [_ (io.run (atom.update (|>> (format "B")) resource))]] (wrap []))] - _ (promise.wait |100) + _ (promise.wait 100) _ (exec (io.run (atom.update (|>> (format "A")) resource)) (/.signal semaphore)) @@ -79,9 +79,9 @@ )))) (context: "Mutex." - (<| (times |100) + (<| (times 100) (do @ - [repetitions (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10))))] + [repetitions (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10))))] ($_ seq (let [mutex (/.mutex [])] (wrap (do promise.Monad<Promise> @@ -122,12 +122,12 @@ (wrap []))) (context: "Barrier." - (let [limit |10 + (let [limit 10 barrier (/.barrier (maybe.assume (/.limit limit))) resource (atom.atom "")] ($_ seq (wrap (do promise.Monad<Promise> - [#let [ids (list.n/range |0 (dec limit)) + [#let [ids (list.n/range 0 (dec limit)) waiters (list/map (function (_ id) (let [process (waiter resource barrier id)] (exec (io.run (atom.update (|>> (format "_")) resource)) diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index 4105551bb..3506146f4 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -28,45 +28,45 @@ channel)] (wrap output))) -(def: iterations-per-process Nat |100) +(def: iterations-per-process Nat 100) (context: "STM" ($_ seq (wrap (do promise.Monad<Promise> - [output (&.commit (&.read (&.var |0)))] + [output (&.commit (&.read (&.var 0)))] (assert "Can read STM vars." - (n/= |0 output)))) + (n/= 0 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |0)] + [#let [_var (&.var 0)] output (&.commit (do &.Monad<STM> - [_ (&.write |5 _var)] + [_ (&.write 5 _var)] (&.read _var)))] (assert "Can write STM vars." - (n/= |5 output)))) + (n/= 5 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |5)] + [#let [_var (&.var 5)] output (&.commit (do &.Monad<STM> - [_ (&.update (n/* |3) _var)] + [_ (&.update (n/* 3) _var)] (&.read _var)))] (assert "Can update STM vars." - (n/= |15 output)))) + (n/= 15 output)))) (wrap (do promise.Monad<Promise> - [#let [_var (&.var |0) + [#let [_var (&.var 0) changes (io.run (read! (io.run (&.follow _var))))] - _ (&.commit (&.write |5 _var)) - _ (&.commit (&.update (n/* |3) _var)) + _ (&.commit (&.write 5 _var)) + _ (&.commit (&.update (n/* 3) _var)) changes (promise.future (atom.read changes))] (assert "Can follow all the changes to STM vars." (:: (list.Equivalence<List> number.Equivalence<Nat>) = - (list |5 |15) + (list 5 15) (list.reverse changes))))) - (wrap (let [_concurrency-var (&.var |0)] + (wrap (let [_concurrency-var (&.var 0)] (do promise.Monad<Promise> [_ (|> promise.parallelism - (list.n/range |1) + (list.n/range 1) (list/map (function (_ _) (|> iterations-per-process - (list.n/range |1) + (list.n/range 1) (M.map @ (function (_ _) (&.commit (&.update inc _concurrency-var))))))) (M.seq @)) last-val (&.commit (&.read _concurrency-var))] diff --git a/stdlib/test/test/lux/control/continuation.lux b/stdlib/test/test/lux/control/continuation.lux index 489742c04..dfe93023a 100644 --- a/stdlib/test/test/lux/control/continuation.lux +++ b/stdlib/test/test/lux/control/continuation.lux @@ -11,12 +11,12 @@ lux/test) (context: "Continuations" - (<| (times |100) + (<| (times 100) (do @ [sample r.nat #let [(^open "&/.") &.Apply<Cont> (^open "&/.") &.Monad<Cont>] - elems (r.list |3 r.nat)] + elems (r.list 3 r.nat)] ($_ seq (test "Can run continuations to compute their values." (n/= sample (&.run (&/wrap sample)))) @@ -34,7 +34,7 @@ (wrap (func arg)))))) (test "Can use the current-continuation as a escape hatch." - (n/= (n/* |2 sample) + (n/= (n/* 2 sample) (&.run (do &.Monad<Cont> [value (&.call/cc (function (_ k) @@ -42,16 +42,16 @@ [temp (k sample)] ## If this code where to run, ## the output would be - ## (n/* |4 sample) + ## (n/* 4 sample) (k temp))))] - (wrap (n/* |2 value)))))) + (wrap (n/* 2 value)))))) (test "Can use the current-continuation to build a time machine." - (n/= (n/+ |100 sample) + (n/= (n/+ 100 sample) (&.run (do &.Monad<Cont> - [[restart [output idx]] (&.portal [sample |0])] - (if (n/< |10 idx) - (restart [(n/+ |10 output) (inc idx)]) + [[restart [output idx]] (&.portal [sample 0])] + (if (n/< 10 idx) + (restart [(n/+ 10 output) (inc idx)]) (wrap output)))))) (test "Can use delimited continuations with shifting." diff --git a/stdlib/test/test/lux/control/exception.lux b/stdlib/test/test/lux/control/exception.lux index 3cffa26c3..36555f490 100644 --- a/stdlib/test/test/lux/control/exception.lux +++ b/stdlib/test/test/lux/control/exception.lux @@ -18,7 +18,7 @@ (exception: unknown-exception) (context: "Exceptions" - (<| (times |100) + (<| (times 100) (do @ [should-throw? r.bit which? r.bit diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux index 2c7192b59..9fe01a0a1 100644 --- a/stdlib/test/test/lux/control/interval.lux +++ b/stdlib/test/test/lux/control/interval.lux @@ -14,7 +14,7 @@ ["L" list]]]]) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [bottom r.int top r.int @@ -29,7 +29,7 @@ (&/= self self)))))))) (context: "Boundaries" - (<| (times |100) + (<| (times 100) (do @ [bottom r.int top r.int @@ -85,7 +85,7 @@ gen-singleton)) (context: "Unions" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval left-inner gen-inner @@ -107,7 +107,7 @@ )))) (context: "Intersections" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval left-inner gen-inner @@ -129,7 +129,7 @@ )))) (context: "Complement" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval #let [(^open "&/.") &.Equivalence<Interval>]] @@ -141,9 +141,9 @@ )))) (context: "Positioning/location" - (<| (times |100) + (<| (times 100) (do @ - [[l m r] (|> (r.set number.Hash<Int> |3 r.int) + [[l m r] (|> (r.set number.Hash<Int> 3 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list b t1 t2)) @@ -163,9 +163,9 @@ )))) (context: "Touching intervals" - (<| (times |100) + (<| (times 100) (do @ - [[b t1 t2] (|> (r.set number.Hash<Int> |3 r.int) + [[b t1 t2] (|> (r.set number.Hash<Int> 3 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list b t1 t2)) @@ -189,10 +189,10 @@ )))) (context: "Nesting & overlap" - (<| (times |100) + (<| (times 100) (do @ [some-interval gen-interval - [x0 x1 x2 x3] (|> (r.set number.Hash<Int> |4 r.int) + [x0 x1 x2 x3] (|> (r.set number.Hash<Int> 4 r.int) (:: @ map (|>> S.to-list (L.sort i/<) (case> (^ (list x0 x1 x2 x3)) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 19ed2000d..378cbccd4 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -67,27 +67,27 @@ (context: "Combinators [Part 1]" ($_ seq (test "Can optionally succeed with some parser." - (and (match (#.Some |123) - (&.run (list (code.nat |123)) + (and (match (#.Some 123) + (&.run (list (code.nat 123)) (&.maybe s.nat))) (match #.None (&.run (list (code.int -123)) (&.maybe s.nat))))) (test "Can apply a parser 0 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.some s.nat))) (match (list) (&.run (list (code.int -123)) (&.some s.nat))))) (test "Can apply a parser 1 or more times." - (and (match (list |123 |456 |789) - (&.run (list (code.nat |123) (code.nat |456) (code.nat |789)) + (and (match (list 123 456 789) + (&.run (list (code.nat 123) (code.nat 456) (code.nat 789)) (&.many s.nat))) - (match (list |123) - (&.run (list (code.nat |123)) + (match (list 123) + (&.run (list (code.nat 123)) (&.many s.nat))) (fails? (&.run (list (code.int -123)) (&.many s.nat))))) @@ -124,40 +124,40 @@ (test "Can apply a parser N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |3 s.int))) + (&.exactly 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |2 s.int))) + (&.exactly 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.exactly |4 s.int))))) + (&.exactly 4 s.int))))) (test "Can apply a parser at-least N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |3 s.int))) + (&.at-least 3 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |2 s.int))) + (&.at-least 2 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-least |4 s.int))))) + (&.at-least 4 s.int))))) (test "Can apply a parser at-most N times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |3 s.int))) + (&.at-most 3 s.int))) (match (list +123 +456) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |2 s.int))) + (&.at-most 2 s.int))) (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.at-most |4 s.int))))) + (&.at-most 4 s.int))))) (test "Can apply a parser between N and M times." (and (match (list +123 +456 +789) (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |3 |10 s.int))) + (&.between 3 10 s.int))) (fails? (&.run (list (code.int +123) (code.int +456) (code.int +789)) - (&.between |4 |10 s.int))))) + (&.between 4 10 s.int))))) (test "Can parse while taking separators into account." (and (match (list +123 +456 +789) diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux index 59f523666..8a419bb0a 100644 --- a/stdlib/test/test/lux/control/region.lux +++ b/stdlib/test/test/lux/control/region.lux @@ -27,14 +27,14 @@ ) (context: "Regions." - (<| (times |100) + (<| (times 100) (do @ - [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1))))] + [expected-clean-ups (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1))))] ($_ seq (test "Clean-up functions are always run when region execution is done." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -43,7 +43,7 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups))] + (list.n/range 1 expected-clean-ups))] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] (wrap (and (success? outcome) @@ -52,7 +52,7 @@ (test "Can clean-up despite errors." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -61,7 +61,7 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups)) + (list.n/range 1 expected-clean-ups)) _ (/.throw @@ oops [])] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] @@ -71,7 +71,7 @@ (test "Errors can propagate from the cleaners." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @ count-clean-up (function (_ value) (do @ @@ -80,17 +80,17 @@ outcome (/.run @ (do (/.Monad<Region> @) [_ (monad.map @ (/.acquire @@ count-clean-up) - (list.n/range |1 expected-clean-ups))] + (list.n/range 1 expected-clean-ups))] (wrap []))) actual-clean-ups (thread.read clean-up-counter)] - (wrap (and (or (n/= |0 expected-clean-ups) + (wrap (and (or (n/= 0 expected-clean-ups) (error? outcome)) (n/= expected-clean-ups actual-clean-ups)))))) (test "Can lift operations." (thread.run (do thread.Monad<Thread> - [clean-up-counter (thread.box |0) + [clean-up-counter (thread.box 0) #let [@@ @] outcome (/.run @ (do (/.Monad<Region> @) diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux index ba5fefb6d..45f8675d8 100644 --- a/stdlib/test/test/lux/control/state.lux +++ b/stdlib/test/test/lux/control/state.lux @@ -19,7 +19,7 @@ (n/= output))) (context: "Basics" - (<| (times |100) + (<| (times 100) (do @ [state r.nat value r.nat] @@ -47,7 +47,7 @@ )))) (context: "Structures" - (<| (times |100) + (<| (times 100) (do @ [state r.nat value r.nat @@ -75,7 +75,7 @@ )))) (context: "Monad transformer" - (<| (times |100) + (<| (times 100) (do @ [state r.nat left r.nat @@ -95,23 +95,23 @@ )))) (context: "Loops" - (<| (times |100) + (<| (times 100) (do @ - [limit (|> r.nat (:: @ map (n/% |10))) + [limit (|> r.nat (:: @ map (n/% 10))) #let [condition (do &.Monad<State> [state &.get] (wrap (n/< limit state)))]] ($_ seq (test "'while' will only execute if the condition is #1." (|> (&.while condition (&.update inc)) - (&.run |0) + (&.run 0) (case> [state' output'] (n/= limit state')))) (test "'do-while' will execute at least once." (|> (&.do-while condition (&.update inc)) - (&.run |0) + (&.run 0) (case> [state' output'] (or (n/= limit state') - (and (n/= |0 limit) - (n/= |1 state')))))) + (and (n/= 0 limit) + (n/= 1 state')))))) )))) diff --git a/stdlib/test/test/lux/control/thread.lux b/stdlib/test/test/lux/control/thread.lux index 5ac666c64..d9867f4bc 100644 --- a/stdlib/test/test/lux/control/thread.lux +++ b/stdlib/test/test/lux/control/thread.lux @@ -7,15 +7,15 @@ (def: _test0_ Nat (/.run (do /.Monad<Thread> - [box (/.box |123) - old (/.update (n/* |2) box) + [box (/.box 123) + old (/.update (n/* 2) box) new (/.read box)] (wrap (n/+ old new))))) (def: _test1_ (All [!] (/.Thread ! Nat)) (do /.Monad<Thread> - [box (/.box |123) - old (/.update (n/* |2) box) + [box (/.box 123) + old (/.update (n/* 2) box) new (/.read box)] (wrap (n/+ old new)))) diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index deabfe265..ecb0c90ad 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -9,7 +9,7 @@ lux/test) (context: "Bit operations." - (<| (times |100) + (<| (times 100) (do @ [value r.bit] (test "" (and (not (and value (not value))) diff --git a/stdlib/test/test/lux/data/collection/array.lux b/stdlib/test/test/lux/data/collection/array.lux index df43a3ef1..ac3061464 100644 --- a/stdlib/test/test/lux/data/collection/array.lux +++ b/stdlib/test/test/lux/data/collection/array.lux @@ -16,10 +16,10 @@ (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |100) (n/+ |1))))) + (:: r.Monad<Random> map (|>> (n/% 100) (n/+ 1))))) (context: "Arrays and their copies" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size original (r.array size r.nat) @@ -35,7 +35,7 @@ (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original clone) (not (is? original clone)))) (test "Full-range manual copies should give the same result as cloning." - (exec (@.copy size |0 original |0 copy) + (exec (@.copy size 0 original 0 copy) (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original copy) (not (is? original copy))))) (test "Array folding should go over all values." @@ -43,7 +43,7 @@ (function (_ x idx) (exec (@.write idx x manual-copy) (inc idx))) - |0 + 0 original) (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original manual-copy))) (test "Transformations between (full) arrays and lists shouldn't cause lose or change any values." @@ -53,7 +53,7 @@ )))) (context: "Array mutation" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -71,17 +71,17 @@ #.None #0)) (test "All cells should be occupied on a full array." (and (n/= size (@.occupied array)) - (n/= |0 (@.vacant array)))) + (n/= 0 (@.vacant array)))) (test "Filtering mutates the array to remove invalid values." (exec (@.filter n/even? array) (and (n/< size (@.occupied array)) - (n/> |0 (@.vacant array)) + (n/> 0 (@.vacant array)) (n/= size (n/+ (@.occupied array) (@.vacant array)))))) )))) (context: "Finding values." - (<| (times |100) + (<| (times 100) (do @ [size bounded-size array (|> (r.array size r.nat) @@ -100,7 +100,7 @@ #.None #0))))))) (context: "Functor" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size array (r.array size r.nat)] @@ -118,7 +118,7 @@ (= array back-again))))))))) (context: "Monoid" - (<| (times |100) + (<| (times 100) (do @ [sizeL bounded-size sizeR bounded-size @@ -133,11 +133,11 @@ (test "First elements of fused array should equal the first array." (|> (: (Array Nat) (@.new sizeL)) - (@.copy sizeL |0 fusion |0) + (@.copy sizeL 0 fusion 0) (= left))) (test "Last elements of fused array should equal the second array." (|> (: (Array Nat) (@.new sizeR)) - (@.copy sizeR sizeL fusion |0) + (@.copy sizeR sizeL fusion 0) (= right))) )))) diff --git a/stdlib/test/test/lux/data/collection/bits.lux b/stdlib/test/test/lux/data/collection/bits.lux index bf6823386..91ab7b828 100644 --- a/stdlib/test/test/lux/data/collection/bits.lux +++ b/stdlib/test/test/lux/data/collection/bits.lux @@ -22,14 +22,14 @@ (def: bits (r.Random /.Bits) (do r.Monad<Random> - [size (size |1 |1_000) + [size (size 1 1_000) idx (|> r.nat (:: @ map (n/% size)))] (wrap (|> /.empty (/.set idx))))) (context: "Bits." - (<| (times |100) + (<| (times 100) (do @ - [size (size |1 |1_000) + [size (size 1 1_000) idx (|> r.nat (:: @ map (n/% size))) sample bits] ($_ seq @@ -43,14 +43,14 @@ (|> /.empty (/.flip idx) (/.flip idx) (/.get idx) not))) (test "Bits (only) grow when (and as much as) necessary." - (and (n/= |0 (/.capacity /.empty)) + (and (n/= 0 (/.capacity /.empty)) (|> /.empty (/.set idx) /.capacity (n/- idx) - (predicate.union (n/>= |0) + (predicate.union (n/>= 0) (n/< /.chunk-size))))) (test "Bits (must) shrink when (and as much as) possible." (let [grown (/.flip idx /.empty)] - (and (n/> |0 (/.capacity grown)) + (and (n/> 0 (/.capacity grown)) (is? /.empty (/.flip idx grown))))) (test "Intersection can be detected when there are set bits in common." diff --git a/stdlib/test/test/lux/data/collection/dictionary.lux b/stdlib/test/test/lux/data/collection/dictionary.lux index a30cdaef0..466cb2872 100644 --- a/stdlib/test/test/lux/data/collection/dictionary.lux +++ b/stdlib/test/test/lux/data/collection/dictionary.lux @@ -14,9 +14,9 @@ lux/test) (context: "Dictionaries." - (<| (times |100) + (<| (times 100) (do @ - [#let [capped-nat (:: r.Monad<Random> map (n/% |100) r.nat)] + [#let [capped-nat (:: r.Monad<Random> map (n/% 100) r.nat)] size capped-nat dict (r.dictionary number.Hash<Nat> size r.nat capped-nat) non-key (|> r.nat (r.filter (function (_ key) (not (&.contains? key dict))))) @@ -26,7 +26,7 @@ (n/= size (&.size dict))) (test "Dictionaries of size 0 should be considered empty." - (if (n/= |0 size) + (if (n/= 0 size) (&.empty? dict) (not (&.empty? dict)))) @@ -62,7 +62,7 @@ _ #1)) (test "Shouldn't be able to put~ an existing key." - (or (n/= |0 size) + (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)) @@ -106,7 +106,7 @@ (= dict' (&.merge dict' dict)))) (test "Can merge values in such a way that they become combined." - (list.every? (function (_ [x x*2]) (n/= (n/* |2 x) x*2)) + (list.every? (function (_ [x x*2]) (n/= (n/* 2 x) x*2)) (list.zip2 (&.values dict) (&.values (&.merge-with n/+ dict dict))))) @@ -115,10 +115,10 @@ (&.put non-key test-val) (&.select (list non-key)) &.size - (n/= |1))) + (n/= 1))) (test "Should be able to re-bind existing values to different keys." - (or (n/= |0 size) + (or (n/= 0 size) (let [first-key (|> dict &.keys list.head maybe.assume) rebound (&.re-bind first-key non-key dict)] (and (n/= (&.size dict) (&.size rebound)) diff --git a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux index d6ec22ec1..a8246887e 100644 --- a/stdlib/test/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/test/test/lux/data/collection/dictionary/ordered.lux @@ -16,9 +16,9 @@ lux/test) (context: "Dictionary" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |100))) + [size (|> r.nat (:: @ map (n/% 100))) keys (r.set number.Hash<Nat> size r.nat) values (r.set number.Hash<Nat> size r.nat) extra-key (|> r.nat (r.filter (|>> (s.member? keys) not))) diff --git a/stdlib/test/test/lux/data/collection/list.lux b/stdlib/test/test/lux/data/collection/list.lux index dbe92f70a..31d5d6155 100644 --- a/stdlib/test/test/lux/data/collection/list.lux +++ b/stdlib/test/test/lux/data/collection/list.lux @@ -18,10 +18,10 @@ (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |100) (n/+ |10))))) + (:: r.Monad<Random> map (|>> (n/% 100) (n/+ 10))))) (context: "Lists: Part 1" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -67,7 +67,7 @@ )))) (context: "Lists: Part 2" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -115,7 +115,7 @@ ))) (test "Segmenting the list in pairs should yield as many elements as N/2." - (n/= (n// |2 size) + (n/= (n// 2 size) (&.size (&.as-pairs sample)))) (test "Sorting a list shouldn't change it's size." @@ -128,7 +128,7 @@ )))) (context: "Lists: Part 3" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -136,8 +136,8 @@ other-size bounded-size other-sample (r.list other-size r.nat) separator r.nat - from (|> r.nat (:: @ map (n/% |10))) - to (|> r.nat (:: @ map (n/% |10))) + from (|> r.nat (:: @ map (n/% 10))) + to (|> r.nat (:: @ map (n/% 10))) #let [(^open ".") (&.Equivalence<List> number.Equivalence<Nat>) (^open "&/.") &.Functor<List>]] ($_ seq @@ -167,7 +167,7 @@ (test "The 'interpose' function places a value between every member of a list." (let [(^open ".") &.Functor<List> sample+ (&.interpose separator sample)] - (and (n/= (|> size (n/* |2) dec) + (and (n/= (|> size (n/* 2) dec) (&.size sample+)) (|> sample+ &.as-pairs (map product.right) (&.every? (n/= separator)))))) @@ -204,9 +204,9 @@ (&.every? (bit.complement n/even?) sample)))) (test "You can iteratively construct a list, generating values until you're done." - (= (&.n/range |0 (dec size)) + (= (&.n/range 0 (dec size)) (&.iterate (function (_ n) (if (n/< size n) (#.Some (inc n)) #.None)) - |0))) + 0))) (test "Can enumerate all elements in a list." (let [enum-sample (&.enumerate sample)] diff --git a/stdlib/test/test/lux/data/collection/queue.lux b/stdlib/test/test/lux/data/collection/queue.lux index 79c254341..9b21411fa 100644 --- a/stdlib/test/test/lux/data/collection/queue.lux +++ b/stdlib/test/test/lux/data/collection/queue.lux @@ -11,15 +11,15 @@ lux/test) (context: "Queues" - (<| (times |100) + (<| (times 100) (do @ - [size (:: @ map (n/% |100) r.nat) + [size (:: @ map (n/% 100) r.nat) sample (r.queue size r.nat) non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] ($_ seq (test "I can query the size of a queue (and empty queues have size 0)." - (if (n/= |0 size) + (if (n/= 0 size) (&.empty? sample) (n/= size (&.size sample)))) diff --git a/stdlib/test/test/lux/data/collection/queue/priority.lux b/stdlib/test/test/lux/data/collection/queue/priority.lux index b0adafd5e..5450b8ad9 100644 --- a/stdlib/test/test/lux/data/collection/queue/priority.lux +++ b/stdlib/test/test/lux/data/collection/queue/priority.lux @@ -24,9 +24,9 @@ inputs))) (context: "Queues" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |100))) + [size (|> r.nat (:: @ map (n/% 100))) sample (gen-queue size) non-member-priority r.nat non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] @@ -37,7 +37,7 @@ (test "Enqueueing and dequeing affects the size of queues." (and (n/= (inc size) (&.size (&.push non-member-priority non-member sample))) - (or (n/= |0 (&.size sample)) + (or (n/= 0 (&.size sample)) (n/= (dec size) (&.size (&.pop sample)))))) @@ -46,7 +46,7 @@ (&.member? number.Equivalence<Nat> (&.push non-member-priority non-member sample) non-member)) - (or (n/= |0 (&.size sample)) + (or (n/= 0 (&.size sample)) (and (&.member? number.Equivalence<Nat> sample (maybe.assume (&.peek sample))) diff --git a/stdlib/test/test/lux/data/collection/row.lux b/stdlib/test/test/lux/data/collection/row.lux index f33a369b7..09b443219 100644 --- a/stdlib/test/test/lux/data/collection/row.lux +++ b/stdlib/test/test/lux/data/collection/row.lux @@ -12,9 +12,9 @@ lux/test) (context: "Rows" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) idx (|> r.nat (:: @ map (n/% size))) sample (r.row size r.nat) other-sample (r.row size r.nat) @@ -27,8 +27,8 @@ ($_ seq (test "Can query size of row." (if (&.empty? sample) - (and (n/= |0 size) - (n/= |0 (&.size sample))) + (and (n/= 0 size) + (n/= 0 (&.size sample))) (n/= size (&.size sample)))) (test "Can add and remove elements to rows." @@ -56,8 +56,8 @@ (&.member? number.Equivalence<Nat> (&.add non-member sample) non-member))) (test "Can fold over elements of row." - (n/= (list/fold n/+ |0 (&.to-list sample)) - (&/fold n/+ |0 sample))) + (n/= (list/fold n/+ 0 (&.to-list sample)) + (&/fold n/+ 0 sample))) (test "Functor goes over every element." (let [there (&/map inc sample) diff --git a/stdlib/test/test/lux/data/collection/sequence.lux b/stdlib/test/test/lux/data/collection/sequence.lux index 1f0298afd..ce8ef1b4f 100644 --- a/stdlib/test/test/lux/data/collection/sequence.lux +++ b/stdlib/test/test/lux/data/collection/sequence.lux @@ -15,38 +15,38 @@ lux/test) (context: "Sequences" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2)))) - offset (|> r.nat (:: @ map (n/% |100))) - factor (|> r.nat (:: @ map (|>> (n/% |100) (n/max |2)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2)))) + offset (|> r.nat (:: @ map (n/% 100))) + factor (|> r.nat (:: @ map (|>> (n/% 100) (n/max 2)))) elem r.nat cycle-seed (r.list size r.nat) - cycle-sample-idx (|> r.nat (:: @ map (n/% |1000))) + cycle-sample-idx (|> r.nat (:: @ map (n/% 1000))) #let [(^open "List/.") (list.Equivalence<List> number.Equivalence<Nat>) - sample0 (&.iterate inc |0) + sample0 (&.iterate inc 0) sample1 (&.iterate inc offset)]] ($_ seq (test "Can move along a sequence and take slices off it." - (and (and (List/= (list.n/range |0 (dec size)) + (and (and (List/= (list.n/range 0 (dec size)) (&.take size sample0)) (List/= (list.n/range offset (dec (n/+ offset size))) (&.take size (&.drop offset sample0))) (let [[drops takes] (&.split size sample0)] - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) drops) - (List/= (list.n/range size (dec (n/* |2 size))) + (List/= (list.n/range size (dec (n/* 2 size))) (&.take size takes))))) - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) (&.take-while (n/< size) sample0)) (List/= (list.n/range offset (dec (n/+ offset size))) (&.take-while (n/< (n/+ offset size)) (&.drop-while (n/< offset) sample0))) (let [[drops takes] (&.split-while (n/< size) sample0)] - (and (List/= (list.n/range |0 (dec size)) + (and (List/= (list.n/range 0 (dec size)) drops) - (List/= (list.n/range size (dec (n/* |2 size))) - (&.take-while (n/< (n/* |2 size)) takes))))) + (List/= (list.n/range size (dec (n/* 2 size))) + (&.take-while (n/< (n/* 2 size)) takes))))) )) (test "Can repeat any element and infinite number of times." @@ -58,13 +58,13 @@ (&.take size (&.tail sample1))))) (test "Can filter sequences." - (and (n/= (n/* |2 offset) + (and (n/= (n/* 2 offset) (&.nth offset (&.filter n/even? sample0))) - (let [[evens odds] (&.partition n/even? (&.iterate inc |0))] - (and (n/= (n/* |2 offset) + (let [[evens odds] (&.partition n/even? (&.iterate inc 0))] + (and (n/= (n/* 2 offset) (&.nth offset evens)) - (n/= (inc (n/* |2 offset)) + (n/= (inc (n/* 2 offset)) (&.nth offset odds)))))) (test "Functor goes over 'all' elements in a sequence." diff --git a/stdlib/test/test/lux/data/collection/set.lux b/stdlib/test/test/lux/data/collection/set.lux index d67503b53..1b94aed8c 100644 --- a/stdlib/test/test/lux/data/collection/set.lux +++ b/stdlib/test/test/lux/data/collection/set.lux @@ -14,10 +14,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Sets" - (<| (times |100) + (<| (times 100) (do @ [sizeL gen-nat sizeR gen-nat diff --git a/stdlib/test/test/lux/data/collection/set/ordered.lux b/stdlib/test/test/lux/data/collection/set/ordered.lux index 16eca4081..7eb313c0f 100644 --- a/stdlib/test/test/lux/data/collection/set/ordered.lux +++ b/stdlib/test/test/lux/data/collection/set/ordered.lux @@ -17,10 +17,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Sets" - (<| (times |100) + (<| (times 100) (do @ [sizeL gen-nat sizeR gen-nat diff --git a/stdlib/test/test/lux/data/collection/stack.lux b/stdlib/test/test/lux/data/collection/stack.lux index b786193b0..954e72e78 100644 --- a/stdlib/test/test/lux/data/collection/stack.lux +++ b/stdlib/test/test/lux/data/collection/stack.lux @@ -13,10 +13,10 @@ (def: gen-nat (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (n/% |100)))) + (:: r.Monad<Random> map (n/% 100)))) (context: "Stacks" - (<| (times |100) + (<| (times 100) (do @ [size gen-nat sample (r.stack size gen-nat) diff --git a/stdlib/test/test/lux/data/collection/tree/rose.lux b/stdlib/test/test/lux/data/collection/tree/rose.lux index 207c6aab9..674ac1d47 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose.lux @@ -19,19 +19,19 @@ (r.Random [Nat (&.Tree Nat)]) (r.rec (function (_ gen-tree) - (r.either (:: r.Monad<Random> map (|>> &.leaf [|1]) r.nat) + (r.either (:: r.Monad<Random> map (|>> &.leaf [1]) r.nat) (do r.Monad<Random> [value r.nat - num-children (|> r.nat (:: @ map (n/% |3))) + num-children (|> r.nat (:: @ map (n/% 3))) children' (r.list num-children gen-tree) - #let [size' (list/fold n/+ |0 (list/map product.left children')) + #let [size' (list/fold n/+ 0 (list/map product.left children')) children (list/map product.right children')]] (wrap [(inc size') (&.branch value children)])) )))) (context: "Trees" - (<| (times |100) + (<| (times 100) (do @ [[size sample] gen-tree #let [(^open "&/.") (&.Equivalence<Tree> number.Equivalence<Nat>) 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 d91b0065d..b1481518b 100644 --- a/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/test/test/lux/data/collection/tree/rose/zipper.lux @@ -22,7 +22,7 @@ (r.rec (function (_ gen-tree) (do r.Monad<Random> ## Each branch can have, at most, 1 child. - [size (|> r.nat (:: @ map (n/% |2)))] + [size (|> r.nat (:: @ map (n/% 2)))] (r.and r.nat (r.list size gen-tree)))))) @@ -34,7 +34,7 @@ (recur (&.next zipper))))) (context: "Zippers." - (<| (times |100) + (<| (times 100) (do @ [sample gen-tree new-val r.nat diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux index 7d584ab4b..8932fad79 100644 --- a/stdlib/test/test/lux/data/color.lux +++ b/stdlib/test/test/lux/data/color.lux @@ -31,8 +31,8 @@ (def: error-margin Frac +1.8) -(def: black @.Color (@.color [|0 |0 |0])) -(def: white @.Color (@.color [|255 |255 |255])) +(def: black @.Color (@.color [0 0 0])) +(def: white @.Color (@.color [255 255 255])) (do-template [<field>] [(def: (<field> color) @@ -45,7 +45,7 @@ ) (context: "Color." - (<| (times |100) + (<| (times 100) (do @ [any color colorful (|> color diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index a898a2c97..dc30d54d7 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -44,7 +44,7 @@ (r.Random @.JSON) (r.rec (function (_ gen-json) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat)] + [size (:: @ map (n/% 2) r.nat)] ($_ r.or (:: @ wrap []) r.bit @@ -55,7 +55,7 @@ ))))) (context: "JSON" - (<| (times |100) + (<| (times 100) (do @ [sample gen-json #let [(^open "@/.") @.Equivalence<JSON> @@ -113,7 +113,7 @@ (def: gen-record (r.Random Record) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat)] + [size (:: @ map (n/% 2) r.nat)] ($_ r.and r.bit r.frac @@ -167,8 +167,8 @@ )))) (context: "Polytypism" - (<| (seed |14562075782602945288) - ## (times |100) + (<| (seed 14562075782602945288) + ## (times 100) (do @ [sample gen-record #let [(^open "@/.") Equivalence<Record> diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index 6e6894f8b..b61ad1a5d 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -44,22 +44,22 @@ (def: xml-identifier^ (r.Random Name) - (r.and (xml-text^ |0 |10) - (xml-text^ |1 |10))) + (r.and (xml-text^ 0 10) + (xml-text^ 1 10))) (def: gen-xml (r.Random &.XML) (r.rec (function (_ gen-xml) - (r.or (xml-text^ |1 |10) + (r.or (xml-text^ 1 10) (do r.Monad<Random> - [size (size^ |0 |2)] + [size (size^ 0 2)] ($_ r.and xml-identifier^ - (r.dictionary name.Hash<Name> size xml-identifier^ (xml-text^ |0 |10)) + (r.dictionary name.Hash<Name> size xml-identifier^ (xml-text^ 0 10)) (r.list size gen-xml))))))) (context: "XML." - (<| (times |100) + (<| (times 100) (do @ [sample gen-xml #let [(^open "&/.") &.Equivalence<XML> @@ -78,14 +78,14 @@ )))) (context: "Parsing." - (<| (times |100) + (<| (times 100) (do @ - [text (xml-text^ |1 |10) - num-children (|> r.nat (:: @ map (n/% |5))) - children (r.list num-children (xml-text^ |1 |10)) + [text (xml-text^ 1 10) + num-children (|> r.nat (:: @ map (n/% 5))) + children (r.list num-children (xml-text^ 1 10)) tag xml-identifier^ attr xml-identifier^ - value (xml-text^ |1 |10) + value (xml-text^ 1 10) #let [node (#&.Node tag (dict.put attr value &.attrs) (list/map (|>> #&.Text) children))]] diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux index 416f3dd56..b5918c281 100644 --- a/stdlib/test/test/lux/data/lazy.lux +++ b/stdlib/test/test/lux/data/lazy.lux @@ -9,7 +9,7 @@ lux/test) (context: "Lazy." - (<| (times |100) + (<| (times 100) (do @ [left r.nat right r.nat @@ -27,7 +27,7 @@ )))) (context: "Functor, Apply, Monad." - (<| (times |100) + (<| (times 100) (do @ [sample r.nat] ($_ seq diff --git a/stdlib/test/test/lux/data/name.lux b/stdlib/test/test/lux/data/name.lux index 16ab67f59..53751066d 100644 --- a/stdlib/test/test/lux/data/name.lux +++ b/stdlib/test/test/lux/data/name.lux @@ -16,17 +16,17 @@ (|> (r.unicode size) (r.filter (|>> (text.contains? ".") not)))) (context: "Names" - (<| (times |100) + (<| (times 100) (do @ [## First Name - sizeM1 (|> r.nat (:: @ map (n/% |100))) - sizeN1 (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + sizeM1 (|> r.nat (:: @ map (n/% 100))) + sizeN1 (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) module1 (gen-part sizeM1) short1 (gen-part sizeN1) #let [name1 [module1 short1]] ## Second Name - sizeM2 (|> r.nat (:: @ map (n/% |100))) - sizeN2 (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + sizeM2 (|> r.nat (:: @ map (n/% 100))) + sizeN2 (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) module2 (gen-part sizeM2) short2 (gen-part sizeN2) #let [name2 [module2 short2]] diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index c8e436d1d..36bc9a3f9 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -13,7 +13,7 @@ (do-template [category rand-gen <Equivalence> <Order>] [(context: (format "[" category "] " "Equivalence & Order") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen y rand-gen] @@ -30,7 +30,7 @@ (do-template [category rand-gen <Number> <Order>] [(context: (format "[" category "] " "Number") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen #let [(^open ".") <Number> @@ -53,7 +53,7 @@ (do-template [category rand-gen <Enum> <Number> <Order>] [(context: (format "[" category "] " "Enum") - (<| (times |100) + (<| (times 100) (do @ [x rand-gen] (test "" (let [(^open ".") <Number> @@ -75,7 +75,7 @@ (do-template [category rand-gen <Number> <Order> <Interval> <test>] [(context: (format "[" category "] " "Interval") - (<| (times |100) + (<| (times 100) (do @ [x (|> rand-gen (r.filter <test>)) #let [(^open ".") <Number> @@ -92,7 +92,7 @@ (do-template [category rand-gen <Number> <Order> <Monoid> <cap> <test>] [(context: (format "[" category "] " "Monoid") - (<| (times |100) + (<| (times 100) (do @ [x (|> rand-gen (:: @ map (|>> (:: <Number> abs) <cap>)) (r.filter <test>)) #let [(^open ".") <Number> @@ -103,10 +103,10 @@ (= x (compose x identity)) (= identity (compose identity identity)))))))] - ["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)] + ["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)] @@ -123,7 +123,7 @@ (do-template [<category> <rand-gen> <Equivalence> <Codec>] [(context: (format "[" <category> "] " "Alternative formats") - (<| (times |100) + (<| (times 100) (do @ [x <rand-gen>] (test "Can encode/decode values." @@ -158,10 +158,10 @@ ) (context: "Can convert frac values to/from their bit patterns." - (<| (times |100) + (<| (times 100) (do @ [raw r.frac - factor (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1)))) + factor (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1)))) #let [sample (|> factor .int int-to-frac (f/* raw))]] (test "Can convert frac values to/from their bit patterns." (|> sample frac-to-bits bits-to-frac (f/= sample)))))) @@ -169,12 +169,12 @@ (context: "Macros for alternative numeric encodings." ($_ seq (test "Binary." - (and (n/= (bin "|11001001") (bin "|11_00_10_01")) + (and (n/= (bin "11001001") (bin "11_00_10_01")) (i/= (bin "+11001001") (bin "+11_00_10_01")) (r/= (bin ".11001001") (bin ".11_00_10_01")) (f/= (bin "+1100.1001") (bin "+11_00.10_01")))) (test "Octal." - (and (n/= (oct "|615243") (oct "|615_243")) + (and (n/= (oct "615243") (oct "615_243")) (i/= (oct "+615243") (oct "+615_243")) (r/= (oct ".615243") (oct ".615_243")) (f/= (oct "+6152.43") (oct "+615_2.43")))) diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 994e1cafb..537027710 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -26,7 +26,7 @@ (def: gen-dim (r.Random Frac) (do r.Monad<Random> - [factor (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1)))) + [factor (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1)))) measure (|> r.frac (r.filter (f/> +0.0)))] (wrap (f/* (|> factor .int int-to-frac) measure)))) @@ -39,7 +39,7 @@ (wrap (&.complex real imaginary)))) (context: "Construction" - (<| (times |100) + (<| (times 100) (do @ [real gen-dim imaginary gen-dim] @@ -55,7 +55,7 @@ )))) (context: "Absolute value" - (<| (times |100) + (<| (times 100) (do @ [real gen-dim imaginary gen-dim] @@ -78,7 +78,7 @@ )))) (context: "Addidion, substraction, multiplication and division" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex y gen-complex @@ -122,7 +122,7 @@ )))) (context: "Conjugate, reciprocal, signum, negation" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex] ($_ seq @@ -162,8 +162,8 @@ (|> normal forward backward (within? margin-of-error normal)))) (context: "Trigonometry" - (<| (seed |17274883666004960943) - ## (times |100) + (<| (seed 17274883666004960943) + ## (times 100) (do @ [angle (|> gen-complex (:: @ map (|>> (update@ #&.real (f/% +1.0)) (update@ #&.imaginary (f/% +1.0)))))] @@ -178,7 +178,7 @@ (trigonometric-symmetry &.tan &.atan angle)))))) (context: "Power 2 and exponential/logarithm" - (<| (times |100) + (<| (times 100) (do @ [x gen-complex] ($_ seq @@ -190,10 +190,10 @@ )))) (context: "Complex roots" - (<| (times |100) + (<| (times 100) (do @ [sample gen-complex - degree (|> r.nat (:: @ map (|>> (n/max |1) (n/% |5))))] + degree (|> r.nat (:: @ map (|>> (n/max 1) (n/% 5))))] (test "Can calculate the N roots for any complex number." (|> sample (&.roots degree) diff --git a/stdlib/test/test/lux/data/number/i64.lux b/stdlib/test/test/lux/data/number/i64.lux index 96a174eaa..62de5e56e 100644 --- a/stdlib/test/test/lux/data/number/i64.lux +++ b/stdlib/test/test/lux/data/number/i64.lux @@ -10,7 +10,7 @@ lux/test) (context: "Bitwise operations." - (<| (times |100) + (<| (times 100) (do @ [pattern r.nat idx (:: @ map (n/% &.width) r.nat)] @@ -20,10 +20,10 @@ (&.count (&.clear idx pattern))) (|> (&.count pattern) (n/- (&.count (&.clear idx pattern))) - (n/<= |1)) + (n/<= 1)) (|> (&.count (&.set idx pattern)) (n/- (&.count pattern)) - (n/<= |1)))) + (n/<= 1)))) (test "Can query whether a bit is set." (and (or (and (&.set? idx pattern) (not (&.set? idx (&.clear idx pattern)))) @@ -39,16 +39,16 @@ (n/+ (&.count pattern) (&.count (&.not pattern))))) (test "Can do simple binary logic." - (and (n/= |0 + (and (n/= 0 (&.and pattern (&.not pattern))) - (n/= (&.not |0) + (n/= (&.not 0) (&.or pattern (&.not pattern))) - (n/= (&.not |0) + (n/= (&.not 0) (&.xor pattern (&.not pattern))) - (n/= |0 + (n/= 0 (&.xor pattern pattern)))) (test "rotate-left and rotate-right are inverses of one another." diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index d30278cf5..aa931d688 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -12,27 +12,27 @@ (def: gen-part (r.Random Nat) - (|> r.nat (:: r.Monad<Random> map (|>> (n/% |1000) (n/max |1))))) + (|> r.nat (:: r.Monad<Random> map (|>> (n/% 1000) (n/max 1))))) (def: gen-ratio (r.Random &.Ratio) (do r.Monad<Random> [numerator gen-part denominator (|> gen-part - (r.filter (|>> (n/= |0) not)) + (r.filter (|>> (n/= 0) not)) (r.filter (|>> (n/= numerator) not)))] (wrap (&.ratio numerator denominator)))) (context: "Normalization" - (<| (times |100) + (<| (times 100) (do @ [denom1 gen-part denom2 gen-part sample gen-ratio] ($_ seq (test "All zeroes are the same." - (&.= (&.ratio |0 denom1) - (&.ratio |0 denom2))) + (&.= (&.ratio 0 denom1) + (&.ratio 0 denom2))) (test "All ratios are built normalized." (|> sample @@ -42,7 +42,7 @@ )))) (context: "Arithmetic" - (<| (times |100) + (<| (times 100) (do @ [x gen-ratio y gen-ratio @@ -67,12 +67,12 @@ (let [remainder (&.% min max) multiple (&.- remainder max) factor (&./ min multiple)] - (and (|> factor (get@ #&.denominator) (n/= |1)) + (and (|> factor (get@ #&.denominator) (n/= 1)) (|> factor (&.* min) (&.+ remainder) (&.= max))))) )))) (context: "Negation, absolute value and signum" - (<| (times |100) + (<| (times 100) (do @ [sample gen-ratio] ($_ seq @@ -90,7 +90,7 @@ )))) (context: "Order" - (<| (times |100) + (<| (times 100) (do @ [x gen-ratio y gen-ratio] @@ -103,7 +103,7 @@ )))) (context: "Codec" - (<| (times |100) + (<| (times 100) (do @ [sample gen-ratio #let [(^open "&/.") &.Codec<Text,Ratio>]] diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index 4023c1cc3..96c0518c0 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -13,25 +13,25 @@ (let [(^open "List/.") (list.Equivalence<List> text.Equivalence<Text>)] ($_ seq (test "Can inject values into Either." - (and (|> (left "Hello") (case> (|0 "Hello") #1 _ #0)) - (|> (right "World") (case> (|1 "World") #1 _ #0)))) + (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)) - (list (|0 "+0") (|1 "+1") (|0 "+2"))))] + (list (0 "+0") (1 "+1") (0 "+2"))))] (and (List/= _lefts (lefts (: (List (| Text Text)) - (list (|0 "+0") (|1 "+1") (|0 "+2"))))) + (list (0 "+0") (1 "+1") (0 "+2"))))) (List/= _rights (rights (: (List (| Text Text)) - (list (|0 "+0") (|1 "+1") (|0 "+2")))))))) + (list (0 "+0") (1 "+1") (0 "+2")))))))) (test "Can apply a function to an Either value depending on the case." (and (i/= +10 (either (function (_ _) +10) (function (_ _) +20) - (: (| Text Text) (|0 "")))) + (: (| Text Text) (0 "")))) (i/= +20 (either (function (_ _) +10) (function (_ _) +20) - (: (| Text Text) (|1 "")))))) + (: (| Text Text) (1 "")))))) ))) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 3d257cd75..a98eb92e6 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -13,21 +13,21 @@ lux/test) (context: "Size" - (<| (times |100) + (<| (times 100) (do @ - [size (:: @ map (n/% |100) r.nat) + [size (:: @ map (n/% 100) r.nat) sample (r.unicode size)] - (test "" (or (and (n/= |0 size) + (test "" (or (and (n/= 0 size) (&.empty? sample)) (n/= size (&.size sample))))))) (def: bounded-size (r.Random Nat) (|> r.nat - (:: r.Monad<Random> map (|>> (n/% |20) (n/+ |1))))) + (:: r.Monad<Random> map (|>> (n/% 20) (n/+ 1))))) (context: "Locations" - (<| (times |100) + (<| (times 100) (do @ [size bounded-size idx (:: @ map (n/% size) r.nat) @@ -56,7 +56,7 @@ )))) (context: "Text functions" - (<| (times |100) + (<| (times 100) (do @ [sizeL bounded-size sizeR bounded-size @@ -83,10 +83,10 @@ _ #0)) - (|> [(&.clip |0 sizeL sample) + (|> [(&.clip 0 sizeL sample) (&.clip sizeL (&.size sample) sample) (&.clip' sizeL sample) - (&.clip' |0 sample)] + (&.clip' 0 sample)] (case> [(#.Right _l) (#.Right _r) (#.Right _r') (#.Right _f)] (and (= sampleL _l) (= sampleR _r) @@ -99,16 +99,16 @@ )))) (context: "More text functions" - (<| (times |100) + (<| (times 100) (do @ [sizeP bounded-size sizeL bounded-size #let [## The wider unicode charset includes control characters that ## can make text replacement work improperly. ## Because of that, I restrict the charset. - normal-char-gen (|> r.nat (:: @ map (|>> (n/% |128) (n/max |1))))] - sep1 (r.text normal-char-gen |1) - sep2 (r.text normal-char-gen |1) + normal-char-gen (|> r.nat (:: @ map (|>> (n/% 128) (n/max 1))))] + sep1 (r.text normal-char-gen 1) + sep2 (r.text normal-char-gen 1) #let [part-gen (|> (r.text normal-char-gen sizeP) (r.filter (|>> (&.contains? sep1) not)))] parts (r.list sizeL part-gen) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index adf4cdf7b..bd66712a8 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -12,7 +12,7 @@ ($_ seq (test "Can format common values simply." (and (&/= "#1" (%b #1)) - (&/= "|123" (%n |123)) + (&/= "123" (%n 123)) (&/= "+123" (%i +123)) (&/= "+123.456" (%f +123.456)) (&/= ".5" (%r .5)) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index d413504e0..d87f91eb4 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -73,9 +73,9 @@ )) (context: "Literals" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) sample (r.unicode size) non-sample (|> (r.unicode size) (r.filter (|>> (text/= sample) not)))] diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 1135dbb0c..96f56c3d9 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -252,26 +252,26 @@ (context: "Regular Expressions [Alternation]" ($_ seq (test "Can specify alternative patterns." - (and (should-check ["a" (|0 [])] (&.regex "a|b") "a") - (should-check ["b" (|1 [])] (&.regex "a|b") "b") + (and (should-check ["a" (0 [])] (&.regex "a|b") "a") + (should-check ["b" (1 [])] (&.regex "a|b") "b") (should-fail (&.regex "a|b") "c"))) (test "Can have groups within alternations." - (and (should-check ["abc" (|0 ["b" "c"])] (&.regex "a(.)(.)|b(.)(.)") "abc") - (should-check ["bcd" (|1 ["c" "d"])] (&.regex "a(.)(.)|b(.)(.)") "bcd") + (and (should-check ["abc" (0 ["b" "c"])] (&.regex "a(.)(.)|b(.)(.)") "abc") + (should-check ["bcd" (1 ["c" "d"])] (&.regex "a(.)(.)|b(.)(.)") "bcd") (should-fail (&.regex "a(.)(.)|b(.)(.)") "cde") - (should-check ["809-345-6789" (|0 ["809" "345-6789" "345" "6789"])] + (should-check ["809-345-6789" (0 ["809" "345-6789" "345" "6789"])] (&.regex "(\\d{3})-((\\d{3})-(\\d{4}))|b(.)d") "809-345-6789"))) )) (context: "Pattern-matching" - (<| (times |100) + (<| (times 100) (do @ - [sample1 (r.unicode |3) - sample2 (r.unicode |3) - sample3 (r.unicode |4)] + [sample1 (r.unicode 3) + sample2 (r.unicode 3) + sample3 (r.unicode 4)] (case (format sample1 "-" sample2 "-" sample3) (&.^regex "(.{3})-(.{3})-(.{4})" [_ match1 match2 match3]) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index d6b125657..49a229d11 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -59,7 +59,7 @@ ([] foo [boolean String] void #throws [Exception])) (context: "Conversions" - (<| (times |100) + (<| (times 100) (do @ [sample r.int] (with-expansions @@ -108,9 +108,9 @@ )) (context: "Arrays" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |1)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1)))) idx (|> r.nat (:: @ map (n/% size))) value r.int] ($_ seq diff --git a/stdlib/test/test/lux/macro/poly/equivalence.lux b/stdlib/test/test/lux/macro/poly/equivalence.lux index 5d7cfee64..8b10dc738 100644 --- a/stdlib/test/test/lux/macro/poly/equivalence.lux +++ b/stdlib/test/test/lux/macro/poly/equivalence.lux @@ -48,7 +48,7 @@ (def: gen-record (r.Random Record) (do r.Monad<Random> - [size (:: @ map (n/% |2) r.nat) + [size (:: @ map (n/% 2) r.nat) #let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% +1_000_000))))]] ($_ r.and r.bit @@ -65,7 +65,7 @@ ## [Tests] (context: "Equivalence polytypism" - (<| (times |100) + (<| (times 100) (do @ [sample gen-record #let [(^open "&/.") Equivalence<Record>]] diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 63d592251..b1e2f445b 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -73,7 +73,7 @@ (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))] ["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 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] ["Can parse Frac syntax." +123.0 code.frac number.Equivalence<Frac> s.frac] diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 83ed1f8b0..4cdb8eed5 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -22,7 +22,7 @@ (|> normal forward backward (within? margin normal)))) (context: "Trigonometry" - (<| (times |100) + (<| (times 100) (do @ [angle (|> r.frac (:: @ map (f/* &.tau)))] ($_ seq @@ -37,7 +37,7 @@ )))) (context: "Rounding" - (<| (times |100) + (<| (times 100) (do @ [sample (|> r.frac (:: @ map (f/* +1000.0)))] ($_ seq @@ -60,34 +60,34 @@ )))) (context: "Exponentials and logarithms" - (<| (times |100) + (<| (times 100) (do @ [sample (|> r.frac (:: @ map (f/* +10.0)))] (test "Logarithm is the inverse of exponential." (|> sample &.exp &.log (within? +1.0e-15 sample)))))) (context: "Greatest-Common-Divisor and Least-Common-Multiple" - (<| (times |100) + (<| (times 100) (do @ - [#let [gen-nat (|> r.nat (:: @ map (|>> (n/% |1000) (n/max |1))))] + [#let [gen-nat (|> r.nat (:: @ map (|>> (n/% 1000) (n/max 1))))] x gen-nat y gen-nat] ($_ seq (test "GCD" (let [gcd (&.n/gcd x y)] - (and (n/= |0 (n/% gcd x)) - (n/= |0 (n/% gcd y)) - (n/>= |1 gcd)))) + (and (n/= 0 (n/% gcd x)) + (n/= 0 (n/% gcd y)) + (n/>= 1 gcd)))) (test "LCM" (let [lcm (&.n/lcm x y)] - (and (n/= |0 (n/% x lcm)) - (n/= |0 (n/% y lcm)) + (and (n/= 0 (n/% x lcm)) + (n/= 0 (n/% y lcm)) (n/<= (n/* x y) lcm)))) )))) (context: "Infix syntax" - (<| (times |100) + (<| (times 100) (do @ [x r.nat y r.nat @@ -109,8 +109,8 @@ (&.infix [&.sin theta]))) (test "Can use regular syntax in the middle of infix code." - (n/= (&.n/gcd |450 (n/* |3 |9)) - (&.infix [(n/* |3 |9) &.n/gcd |450]))) + (n/= (&.n/gcd 450 (n/* 3 9)) + (&.infix [(n/* 3 9) &.n/gcd 450]))) (test "Can use non-numerical functions/macros as operators." (bit/= (and (n/< y x) (n/< z y)) diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index 02329d05d..b9db253f6 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -9,7 +9,7 @@ lux/test) (context: "Operations" - (<| (times |100) + (<| (times 100) (do @ [left r.rev right r.rev] diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index ad23d2eb9..fe36a58c5 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -19,9 +19,9 @@ (do-template [<desc> <hash> <gen> <triangle> <lt> <lte> <gt> <gte>] [(context: (format "[" <desc> "] " "Triangles") - (<| (times |100) + (<| (times 100) (do @ - [values (r.set <hash> |3 <gen>) + [values (r.set <hash> 3 <gen>) #let [[x y z] (case (set.to-list values) (^ (list x y z)) [x y z] @@ -60,9 +60,9 @@ (do-template [<desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>] [(context: (format "[" <desc> "] " "Trapezoids") - (<| (times |100) + (<| (times 100) (do @ - [values (r.set <hash> |4 <gen>) + [values (r.set <hash> 4 <gen>) #let [[w x y z] (case (set.to-list values) (^ (list w x y z)) [w x y z] @@ -114,7 +114,7 @@ (wrap (&.triangle x y z)))) (context: "Combinators" - (<| (times |100) + (<| (times 100) (do @ [left gen-triangle right gen-triangle @@ -148,10 +148,10 @@ )))) (context: "From predicates and sets" - (<| (times |100) + (<| (times 100) (do @ - [#let [set-10 (set.from-list number.Hash<Nat> (list.n/range |0 |10))] - sample (|> r.nat (:: @ map (n/% |20)))] + [#let [set-10 (set.from-list number.Hash<Nat> (list.n/range 0 10))] + sample (|> r.nat (:: @ map (n/% 20)))] ($_ seq (test "Values that satisfy a predicate have membership = 1. Values that don't have membership = 0." @@ -165,7 +165,7 @@ )))) (context: "Thresholds" - (<| (times |100) + (<| (times 100) (do @ [fuzzy gen-triangle sample r.rev diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux index 43f7d178e..559928304 100644 --- a/stdlib/test/test/lux/math/modular.lux +++ b/stdlib/test/test/lux/math/modular.lux @@ -60,7 +60,7 @@ (/.m/= (m/! param subject))))) (context: "Modular arithmetic." - (<| (times |100) + (<| (times 100) (do @ [_normalM modulusR _alternativeM (|> modulusR (r.filter (|>> (i/= _normalM) not))) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index 5085855e6..f3f118c90 100644 --- a/stdlib/test/test/lux/math/random.lux +++ b/stdlib/test/test/lux/math/random.lux @@ -17,9 +17,9 @@ lux/test) (context: "Random." - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) _list (r.list size r.nat) _row (r.row size r.nat) _array (r.array size r.nat) diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux index 600f67b87..602ecc78f 100644 --- a/stdlib/test/test/lux/time/date.lux +++ b/stdlib/test/test/lux/time/date.lux @@ -30,7 +30,7 @@ (random/wrap #@.December)))))) (context: "(Month) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample month #let [(^open "@/.") @.Equivalence<Month>]] @@ -38,7 +38,7 @@ (@/= sample sample))))) (context: "(Month) Order." - (<| (times |100) + (<| (times 100) (do @ [reference month sample month @@ -50,7 +50,7 @@ (@/<= reference sample))))))) (context: "(Month) Enum." - (<| (times |100) + (<| (times 100) (do @ [sample month #let [(^open "@/.") @.Enum<Month>]] @@ -73,7 +73,7 @@ (random/wrap #@.Saturday)))) (context: "(Day) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample day #let [(^open "@/.") @.Equivalence<Day>]] @@ -81,7 +81,7 @@ (@/= sample sample))))) (context: "(Day) Order." - (<| (times |100) + (<| (times 100) (do @ [reference day sample day @@ -93,7 +93,7 @@ (@/<= reference sample))))))) (context: "(Day) Enum." - (<| (times |100) + (<| (times 100) (do @ [sample day #let [(^open "@/.") @.Enum<Day>]] @@ -110,7 +110,7 @@ (|> _instant.instant (:: r.Monad<Random> map @instant.date))) (context: "(Date) Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample date #let [(^open "@/.") @.Equivalence<Date>]] @@ -118,7 +118,7 @@ (@/= sample sample))))) (context: "(Date) Order." - (<| (times |100) + (<| (times 100) (do @ [reference date sample date @@ -130,8 +130,8 @@ (@/<= reference sample))))))) (context: "(Date) Codec" - (<| (seed |6623983470548808292) - ## (times |100) + (<| (seed 6623983470548808292) + ## (times 100) (do @ [sample date #let [(^open "@/.") @.Equivalence<Date> diff --git a/stdlib/test/test/lux/time/duration.lux b/stdlib/test/test/lux/time/duration.lux index 0f8c9f553..1231fb563 100644 --- a/stdlib/test/test/lux/time/duration.lux +++ b/stdlib/test/test/lux/time/duration.lux @@ -16,14 +16,14 @@ (|> r.int (:: r.Monad<Random> map @.from-millis))) (context: "Conversion." - (<| (times |100) + (<| (times 100) (do @ [millis r.int] (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample duration #let [(^open "@/.") @.Equivalence<Duration>]] @@ -31,7 +31,7 @@ (@/= sample sample))))) (context: "Order." - (<| (times |100) + (<| (times 100) (do @ [reference duration sample duration @@ -43,7 +43,7 @@ (@/<= reference sample))))))) (context: "Arithmetic." - (<| (times |100) + (<| (times 100) (do @ [sample (|> duration (:: @ map (@.frame @.day))) frame duration @@ -74,7 +74,7 @@ frame)))))))))) (context: "Codec" - (<| (times |100) + (<| (times 100) (do @ [sample duration #let [(^open "@/.") @.Equivalence<Duration> diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux index db4898e20..734456765 100644 --- a/stdlib/test/test/lux/time/instant.lux +++ b/stdlib/test/test/lux/time/instant.lux @@ -25,14 +25,14 @@ (|> r.int (:: r.Monad<Random> map (|>> (i/% boundary) @.from-millis)))) (context: "Conversion." - (<| (times |100) + (<| (times 100) (do @ [millis r.int] (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) (context: "Equivalence." - (<| (times |100) + (<| (times 100) (do @ [sample instant #let [(^open "@/.") @.Equivalence<Instant>]] @@ -40,7 +40,7 @@ (@/= sample sample))))) (context: "Order" - (<| (times |100) + (<| (times 100) (do @ [reference instant sample instant @@ -52,7 +52,7 @@ (@/<= reference sample))))))) (context: "Enum" - (<| (times |100) + (<| (times 100) (do @ [sample instant #let [(^open "@/.") @.Enum<Instant>]] @@ -65,7 +65,7 @@ (|> sample @/pred @/succ (@/= sample))))))) (context: "Arithmetic" - (<| (times |100) + (<| (times 100) (do @ [sample instant span _duration.duration @@ -82,8 +82,8 @@ (|> @.epoch (@.shift (@.relative sample)) (@/= sample))))))) ## (context: "Codec" -## (<| (seed |9863552679229274604) -## ## (times |100) +## (<| (seed 9863552679229274604) +## ## (times 100) ## (do @ ## [sample instant ## #let [(^open "@/.") @.Equivalence<Instant> diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index cd335e420..e8de83c56 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -18,7 +18,7 @@ (def: #export gen-short (r.Random Text) (do r.Monad<Random> - [size (|> r.nat (:: @ map (n/% |10)))] + [size (|> r.nat (:: @ map (n/% 10)))] (r.unicode size))) (def: #export gen-name @@ -48,7 +48,7 @@ ## [Tests] (context: "Types" - (<| (times |100) + (<| (times 100) (do @ [sample gen-type] (test "Every type is equal to itself." @@ -84,9 +84,9 @@ (&.un-name aliased))))))) (context: "Type construction [structs]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) members (|> gen-type (r.filter (function (_ type) (case type @@ -115,9 +115,9 @@ ))))) (context: "Type construction [parameterized]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) members (M.seq @ (list.repeat size gen-type)) extra (|> gen-type (r.filter (function (_ type) @@ -141,9 +141,9 @@ )))) (context: "Type construction [higher order]" - (<| (times |100) + (<| (times 100) (do @ - [size (|> r.nat (:: @ map (n/% |3))) + [size (|> r.nat (:: @ map (n/% 3))) extra (|> gen-type (r.filter (function (_ type) (case type diff --git a/stdlib/test/test/lux/type/check.lux b/stdlib/test/test/lux/type/check.lux index 1ea83a10e..c5700f8cb 100644 --- a/stdlib/test/test/lux/type/check.lux +++ b/stdlib/test/test/lux/type/check.lux @@ -50,7 +50,7 @@ ## [Tests] (context: "Any and Nothing." - (<| (times |100) + (<| (times 100) (do @ [sample (|> //.gen-type (r.filter valid-type?))] ($_ seq @@ -98,7 +98,7 @@ )) (context: "Type application." - (<| (times |100) + (<| (times 100) (do @ [meta //.gen-type data //.gen-type] @@ -109,7 +109,7 @@ (|> Ann (#.Apply meta) (#.Apply data)))))))) (context: "Primitive types." - (<| (times |100) + (<| (times 100) (do @ [nameL //.gen-short nameR (|> //.gen-short (r.filter (|>> (text/= nameL) not))) @@ -177,9 +177,9 @@ (wrap [[head-id head-type] ids+types [tail-id tail-type]]))) (context: "Rings of type variables." - (<| (times |100) + (<| (times 100) (do @ - [num-connections (|> r.nat (:: @ map (n/% |100))) + [num-connections (|> r.nat (:: @ map (n/% 100))) boundT (|> //.gen-type (r.filter (|>> (case> (#.Var _) #0 _ #1)))) pick-pcg (r.and r.nat r.nat)] ($_ seq @@ -227,7 +227,7 @@ headRR-post (@.ring head-idR)] (@.assert "" (let [same-rings? (:: set.Equivalence<Set> = headRL-post headRR-post) - expected-size? (n/= (n/* |2 (inc num-connections)) + expected-size? (n/= (n/* 2 (inc num-connections)) (set.size headRL-post)) union? (:: set.Equivalence<Set> = headRL-post (set.union headRL-pre headRR-pre))] (and same-rings? diff --git a/stdlib/test/test/lux/type/implicit.lux b/stdlib/test/test/lux/type/implicit.lux index daf259609..669d720c2 100644 --- a/stdlib/test/test/lux/type/implicit.lux +++ b/stdlib/test/test/lux/type/implicit.lux @@ -15,7 +15,7 @@ lux/test) (context: "Automatic structure selection" - (<| (times |100) + (<| (times 100) (do @ [x r.nat y r.nat] @@ -24,17 +24,17 @@ (let [(^open "list/.") (list.Equivalence<List> number.Equivalence<Nat>)] (and (bit/= (:: number.Equivalence<Nat> = x y) (::: = x y)) - (list/= (list.n/range |1 |10) - (::: map inc (list.n/range |0 |9))) + (list/= (list.n/range 1 10) + (::: map inc (list.n/range 0 9))) ))) (test "Can automatically select second-order structures." (::: = - (list.n/range |1 |10) - (list.n/range |1 |10))) + (list.n/range 1 10) + (list.n/range 1 10))) (test "Can automatically select third-order structures." - (let [lln (::: map (list.n/range |1) - (list.n/range |1 |10))] + (let [lln (::: map (list.n/range 1) + (list.n/range 1 10))] (::: = lln lln))) )))) diff --git a/stdlib/test/test/lux/type/resource.lux b/stdlib/test/test/lux/type/resource.lux index b3eabd995..cf6d49b17 100644 --- a/stdlib/test/test/lux/type/resource.lux +++ b/stdlib/test/test/lux/type/resource.lux @@ -11,37 +11,37 @@ (context: "Sub-structural typing." ($_ seq (test "Can produce and consume keys in an ordered manner." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.ordered-sync |123) - res|right (resource.ordered-sync |456) + [res|left (resource.ordered-sync 123) + res|right (resource.ordered-sync 456) right (resource.read-sync res|right) left (resource.read-sync res|left)] (wrap (n/+ left right))))) (test "Can exchange commutative keys." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.commutative-sync |123) - res|right (resource.commutative-sync |456) - _ (resource.exchange-sync [|1 |0]) + [res|left (resource.commutative-sync 123) + res|right (resource.commutative-sync 456) + _ (resource.exchange-sync [1 0]) left (resource.read-sync res|left) right (resource.read-sync res|right)] (wrap (n/+ left right))))) (test "Can group and un-group keys." - (<| (n/= (n/+ |123 |456)) + (<| (n/= (n/+ 123 456)) io.run resource.run-sync (do resource.IxMonad<Sync> - [res|left (resource.commutative-sync |123) - res|right (resource.commutative-sync |456) - _ (resource.group-sync |2) - _ (resource.un-group-sync |2) + [res|left (resource.commutative-sync 123) + res|right (resource.commutative-sync 456) + _ (resource.group-sync 2) + _ (resource.un-group-sync 2) right (resource.read-sync res|right) left (resource.read-sync res|left)] (wrap (n/+ left right))))) diff --git a/stdlib/test/test/lux/world/binary.lux b/stdlib/test/test/lux/world/binary.lux index b5b625f50..a6a6df9d6 100644 --- a/stdlib/test/test/lux/world/binary.lux +++ b/stdlib/test/test/lux/world/binary.lux @@ -30,7 +30,7 @@ (def: #export (binary size) (-> Nat (r.Random /.Binary)) (let [output (/.create size)] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (do r.Monad<Random> [byte r.nat] @@ -40,19 +40,19 @@ (def: (bits-io bytes read write value) (-> Nat (-> Nat /.Binary (e.Error Nat)) (-> Nat Nat /.Binary (e.Error Any)) Nat Bit) - (let [binary (/.create |8) - bits (n/* |8 bytes) - capped-value (|> |1 (i64.left-shift bits) dec (i64.and value))] + (let [binary (/.create 8) + bits (n/* 8 bytes) + capped-value (|> 1 (i64.left-shift bits) dec (i64.and value))] (succeed (do e.Monad<Error> - [_ (write |0 value binary) - output (read |0 binary)] + [_ (write 0 value binary) + output (read 0 binary)] (wrap (n/= capped-value output)))))) (context: "Binary." - (<| (times |100) + (<| (times 100) (do @ - [#let [gen-size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |8))))] + [#let [gen-size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 8))))] binary-size gen-size random-binary (binary binary-size) value r.nat @@ -65,17 +65,17 @@ (test "Can get size of binary." (|> random-binary /.size (n/= binary-size))) (test "Can read/write 8-bit values." - (bits-io |1 /.read/8 /.write/8 value)) + (bits-io 1 /.read/8 /.write/8 value)) (test "Can read/write 16-bit values." - (bits-io |2 /.read/16 /.write/16 value)) + (bits-io 2 /.read/16 /.write/16 value)) (test "Can read/write 32-bit values." - (bits-io |4 /.read/32 /.write/32 value)) + (bits-io 4 /.read/32 /.write/32 value)) (test "Can read/write 64-bit values." - (bits-io |8 /.read/64 /.write/64 value)) + (bits-io 8 /.read/64 /.write/64 value)) (test "Can slice binaries." (let [slice-size (|> to (n/- from) inc) random-slice (e.assume (/.slice from to random-binary)) - idxs (list.n/range |0 (dec slice-size)) + idxs (list.n/range 0 (dec slice-size)) reader (function (_ binary idx) (/.read/8 idx binary))] (and (n/= slice-size (/.size random-slice)) (case [(monad.map e.Monad<Error> (reader random-slice) idxs) diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux index 857b6afb5..b9bd2457a 100644 --- a/stdlib/test/test/lux/world/file.lux +++ b/stdlib/test/test/lux/world/file.lux @@ -27,7 +27,7 @@ (context: "File system." (do @ - [file-size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + [file-size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) dataL (_binary.binary file-size) dataR (_binary.binary file-size) code r.nat @@ -37,7 +37,7 @@ instant.absolute)))] ($_ seq (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |0 code)))] + [#let [file (format "temp_file_" (%n (n/+ 0 code)))] result (promise.future (do (:: @.JVM@System &monad) [pre! (@.exists? @.JVM@System file) @@ -50,7 +50,7 @@ (assert "Can create/delete files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |1 code)))] + [#let [file (format "temp_file_" (%n (n/+ 1 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -60,7 +60,7 @@ (assert "Can write/read files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |2 code)))] + [#let [file (format "temp_file_" (%n (n/+ 2 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -70,7 +70,7 @@ (assert "Can read file size." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |3 code)))] + [#let [file (format "temp_file_" (%n (n/+ 3 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -78,13 +78,13 @@ output (:: @.JVM@System read file) read-size (:: @.JVM@System size file) _ (:: @.JVM@System delete file)] - (wrap (and (n/= (n/* |2 file-size) read-size) - (:: binary.Equivalence<Binary> = dataL (error.assume (binary.slice |0 (dec file-size) output))) + (wrap (and (n/= (n/* 2 file-size) read-size) + (:: binary.Equivalence<Binary> = dataL (error.assume (binary.slice 0 (dec file-size) output))) (:: binary.Equivalence<Binary> = dataR (error.assume (binary.slice file-size (dec read-size) output)))))))] (assert "Can append to files." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [dir (format "temp_dir_" (%n (n/+ |4 code)))] + [#let [dir (format "temp_dir_" (%n (n/+ 4 code)))] result (promise.future (do (:: @.JVM@System &monad) [pre! (@.exists? @.JVM@System dir) @@ -97,8 +97,8 @@ (assert "Can create/delete directories." (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)))] + [#let [file (format "temp_file_" (%n (n/+ 5 code))) + dir (format "temp_dir_" (%n (n/+ 5 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -114,8 +114,8 @@ (assert "Can differentiate files from directories." (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)))] + [#let [file (format "temp_file_" (%n (n/+ 6 code))) + dir (format "temp_dir_" (%n (n/+ 6 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System make-directory dir) @@ -128,8 +128,8 @@ (assert "Can create files inside of directories." (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)))] + [#let [file (format "temp_file_" (%n (n/+ 7 code))) + dir (format "temp_dir_" (%n (n/+ 7 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System make-directory dir) @@ -147,7 +147,7 @@ (assert "Can list files inside a directory." (error.default #0 result)))) (wrap (do promise.Monad<Promise> - [#let [file (format "temp_file_" (%n (n/+ |8 code)))] + [#let [file (format "temp_file_" (%n (n/+ 8 code)))] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file) @@ -158,8 +158,8 @@ (assert "Can change the time of last modification." (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")] + [#let [file0 (format "temp_file_" (%n (n/+ 9 code)) "+0") + file1 (format "temp_file_" (%n (n/+ 9 code)) "+1")] result (promise.future (do (:: @.JVM@System &monad) [_ (:: @.JVM@System write dataL file0) diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index fb2ea3649..7520a2fbc 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -27,13 +27,13 @@ (r.Random net.Port) (|> r.nat (:: r.Monad<Random> map - (|>> (n/% |1000) - (n/+ |8000))))) + (|>> (n/% 1000) + (n/+ 8000))))) (context: "TCP networking." (do @ [port ..port - size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) from (_binary.binary size) to (_binary.binary size) #let [temp-from (binary.create size) @@ -46,18 +46,18 @@ (P.promise #.Nil)) _ (frp/map (function (_ socket) (do @ - [bytes-from (@.read temp-from |0 size socket) + [bytes-from (@.read temp-from 0 size socket) #let [_ (io.run (P.resolve (#E.Success (and (n/= size bytes-from) (:: binary.Equivalence<Binary> = from temp-from))) from-worked?))]] - (@.write to |0 size socket))) + (@.write to 0 size socket))) server)] client (@.client localhost port) - _ (@.write from |0 size client) + _ (@.write from 0 size client) from-worked? from-worked? #################### - bytes-to (@.read temp-to |0 size client) + bytes-to (@.read temp-to 0 size client) #let [to-worked? (and (n/= size bytes-to) (:: binary.Equivalence<Binary> = to temp-to))] #################### diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index 8365452a1..497cef8f3 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -24,13 +24,13 @@ (r.Random net.Port) (|> r.nat (:: r.Monad<Random> map - (|>> (n/% |1000) - (n/+ |8000))))) + (|>> (n/% 1000) + (n/+ 8000))))) (context: "UDP networking." (do @ [port ..port - size (|> r.nat (:: @ map (|>> (n/% |100) (n/max |10)))) + size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10)))) from (_binary.binary size) to (_binary.binary size) #let [temp (binary.create size)]] @@ -40,13 +40,13 @@ [server (@.server port) client (@.client []) #################### - _ (@.write localhost port from |0 size client) - [bytes-from from-address from-port] (@.read temp |0 size server) + _ (@.write localhost port from 0 size client) + [bytes-from from-address from-port] (@.read temp 0 size server) #let [from-worked? (and (n/= size bytes-from) (:: binary.Equivalence<Binary> = from temp))] #################### - _ (@.write from-address from-port to |0 size server) - [bytes-to to-address to-port] (@.read temp |0 size client) + _ (@.write from-address from-port to 0 size server) + [bytes-to to-address to-port] (@.read temp 0 size client) #let [to-worked? (and (n/= size bytes-to) (:: binary.Equivalence<Binary> = to temp) (n/= port to-port))] |