diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 592 |
1 files changed, 296 insertions, 296 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index a9c442462..a30c03a78 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1,168 +1,168 @@ ("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" + (|10 ["lux" "List"] + (|7 (|0) + (|1 ## "lux.Nil" Any ## "lux.Cons" - (+2 (+4 +1) - (+9 (+4 +1) (+4 +0)))))) + (|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).")]] + (|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.")]] + (|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). - - They start at zero (+0) and extend in the positive direction.")]] + (|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))))]) ("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.")]] + (|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))))]) ("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.")]] + (|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.")]] + (|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))))]) @@ -171,23 +171,23 @@ ## #None ## (#Some a)) ("lux def" Maybe - (+10 ["lux" "Maybe"] - (+7 #Nil - (+1 ## "lux.None" + (|10 ["lux" "Maybe"] + (|7 #Nil + (|1 ## "lux.None" Any ## "lux.Some" - (+4 +1)))) + (|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.")]] + (|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 @@ -204,59 +204,59 @@ ## (#Named Name Type) ## ) ("lux def" Type - (+10 ["lux" "Type"] + (|10 ["lux" "Type"] ({Type ({Type-List ({Type-Pair - (+9 Nothing - (+7 #Nil - (+1 ## "lux.Primitive" - (+2 Text Type-List) - (+1 ## "lux.Sum" + (|9 Nothing + (|7 #Nil + (|1 ## "lux.Primitive" + (|2 Text Type-List) + (|1 ## "lux.Sum" Type-Pair - (+1 ## "lux.Product" + (|1 ## "lux.Product" Type-Pair - (+1 ## "lux.Function" + (|1 ## "lux.Function" Type-Pair - (+1 ## "lux.Parameter" + (|1 ## "lux.Parameter" Nat - (+1 ## "lux.Var" + (|1 ## "lux.Var" Nat - (+1 ## "lux.Ex" + (|1 ## "lux.Ex" Nat - (+1 ## "lux.UnivQ" - (+2 Type-List Type) - (+1 ## "lux.ExQ" - (+2 Type-List Type) - (+1 ## "lux.Apply" + (|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))))) + (|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")] + (|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)]] + (#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 @@ -267,17 +267,17 @@ (#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")] + (|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)]] + (#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) @@ -287,21 +287,21 @@ (#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")] + (|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)]] + (#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) @@ -346,29 +346,29 @@ )))))))))) )} ("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")] + (|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)]] + (#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 @@ -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) |