diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 744 |
1 files changed, 372 insertions, 372 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index a9c442462..34ceb43ba 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 @@ -1029,7 +1029,7 @@ (#Cons [(tag$ ["lux" "doc"]) (text$ "## Throws away any code given to it. ## Great for commenting-out code, while retaining syntax high-lighting and formatting in your text editor. - (comment 1 2 3 4)")] + (comment +1 +2 +3 +4)")] #Nil) (return #Nil)) @@ -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]) @@ -1338,7 +1338,7 @@ (macro:' #export (list xs) (#Cons [(tag$ ["lux" "doc"]) (text$ "## List-construction macro. - (list 1 2 3)")] + (list +1 +2 +3)")] #Nil) (return (#Cons (list/fold (function'' [head tail] (form$ (#Cons (tag$ ["lux" "Cons"]) @@ -1352,7 +1352,7 @@ (#Cons [(tag$ ["lux" "doc"]) (text$ "## List-construction macro, with the last element being a tail-list. ## In other words, this macro prepends elements to another list. - (list& 1 2 3 (list 4 5 6))")] + (list& +1 +2 +3 (list +4 +5 +6))")] #Nil) ({(#Cons last init) (return (list (list/fold (function'' [head tail] @@ -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) @@ -2257,7 +2257,7 @@ (-> Int Int) (i/+ <diff>))] - [inc 1] + [inc +1] [dec -1])")]) ({(#Cons [[_ (#Tuple bindings)] (#Cons [[_ (#Tuple templates)] data])]) ({[(#Some bindings') (#Some data')] @@ -2364,14 +2364,14 @@ (list [(tag$ ["lux" "doc"]) (text$ "Nat(ural) division.")]) (-> Nat Nat Nat) - (if ("lux int <" ("lux coerce" Int param) 0) + (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,32 +2452,32 @@ 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) (list [(tag$ ["lux" "doc"]) (text$ "Rev(olution) division.")]) (-> Rev Rev Rev) - (if ("lux i64 =" 0 param) + (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)] + (if ("lux i64 =" +0 trailing-zeroes) + [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) - (text/compose "+" output) - (recur (n// +10 input) - (text/compose (|> input (n/% +10) digit-to-text) + (if (n/= 0 input) + output + (recur (n// 10 input) + (text/compose (|> input (n/% 10) digit-to-text) output)))))] (loop value ""))} value)) @@ -2570,27 +2570,27 @@ (def:''' (int/abs value) #Nil (-> Int Int) - (if (i/< 0 value) + (if (i/< +0 value) (i/* -1 value) value)) (def:''' (int/encode value) #Nil (-> Int Text) - (if (i/= 0 value) + (if (i/= +0 value) "0" - (let' [sign (if (i/> 0 value) + (let' [sign (if (i/> +0 value) "" "-")] (("lux check" (-> Int Text Text) (function' recur [input output] - (if (i/= 0 input) + (if (i/= +0 input) (text/compose sign output) - (recur (i// 10 input) - (text/compose (|> input (i/% 10) ("lux coerce" Nat) digit-to-text) + (recur (i// +10 input) + (text/compose (|> input (i/% +10) ("lux coerce" Nat) digit-to-text) output))))) - (|> value (i// 10) int/abs) - (|> value (i/% 10) int/abs ("lux coerce" Nat) digit-to-text))))) + (|> value (i// +10) int/abs) + (|> value (i/% +10) int/abs ("lux coerce" Nat) digit-to-text))))) (def:''' (frac/encode x) #Nil @@ -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"]) @@ -2836,7 +2836,7 @@ (macro:' #export (: tokens) (list [(tag$ ["lux" "doc"]) (text$ "## The type-annotation macro. - (: (List Int) (list 1 2 3))")]) + (: (List Int) (list +1 +2 +3))")]) ({(#Cons type (#Cons value #Nil)) (return (list (` ("lux check" (type (~ type)) (~ value))))) @@ -2847,7 +2847,7 @@ (macro:' #export (:coerce tokens) (list [(tag$ ["lux" "doc"]) (text$ "## The type-coercion macro. - (:coerce Dinosaur (list 1 2 3))")]) + (:coerce Dinosaur (list +1 +2 +3))")]) ({(#Cons type (#Cons value #Nil)) (return (list (` ("lux coerce" (type (~ type)) (~ value))))) @@ -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'))))))) @@ -3117,7 +3117,7 @@ (list [(tag$ ["lux" "doc"]) (text$ "## The pattern-matching macro. ## Allows the usage of macros within the patterns to provide custom syntax. - (case (: (List Int) (list 1 2 3)) + (case (: (List Int) (list +1 +2 +3)) (#Cons x (#Cons y (#Cons z #Nil))) (#Some ($_ i/* x y z)) @@ -3136,7 +3136,7 @@ (list [(tag$ ["lux" "doc"]) (text$ "## Macro-expanding patterns. ## It's a special macro meant to be used with 'case'. - (case (: (List Int) (list 1 2 3)) + (case (: (List Int) (list +1 +2 +3)) (^ (list x y z)) (#Some ($_ i/* x y z)) @@ -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'] @@ -3353,7 +3353,7 @@ (def: branching-exponent Int - 5)")]) + +5)")]) (let [[export? tokens'] (export^ tokens) parts (: (Maybe [Code (List Code) (Maybe Code) Code (List [Code Code])]) (case tokens' @@ -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) @@ -3610,9 +3610,9 @@ (macro: (default tokens state) {#.doc "## Allows you to provide a default value that will be used ## if a (Maybe x) value turns out to be #.None. - (default 20 (#.Some 10)) => 10 + (default +20 (#.Some +10)) => +10 - (default 20 #.None) => 20"} + (default +20 #.None) => +20"} (case tokens (^ (list else maybe)) (let [g!temp (: Code [dummy-cursor (#Identifier ["" ""])]) @@ -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. @@ -4872,7 +4872,7 @@ (:: Codec<Text,Int> encode) ## Also allows using that value as a function. - (:: Codec<Text,Int> encode 123)"} + (:: Codec<Text,Int> encode +123)"} (case tokens (^ (list struct [_ (#Identifier member)])) (return (list (` (let [(^open ".") (~ struct)] (~ (identifier$ member)))))) @@ -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."] @@ -5199,7 +5199,7 @@ (def: (repeat n x) (All [a] (-> Int a (List a))) - (if (i/> 0 n) + (if (i/> +0 n) (#Cons x (repeat (i/+ -1 n) x)) #Nil)) @@ -5289,9 +5289,9 @@ ## For Example: (doc \"Allows arbitrary looping, using the \\\"recur\\\" form to re-start the loop. Can be used in monadic code to create monadic loops.\" - (loop [count 0 + (loop [count +0 x init] - (if (< 10 count) + (if (< +10 count) (recur (inc count) (f x)) x)))"} (return (list (` [(~ cursor-code) @@ -5354,17 +5354,17 @@ (macro: #export (loop tokens) {#.doc (doc "Allows arbitrary looping, using the \"recur\" form to re-start the loop." "Can be used in monadic code to create monadic loops." - (loop [count 0 + (loop [count +0 x init] - (if (< 10 count) + (if (< +10 count) (recur (inc count) (f x)) x)) "Loops can also be given custom names." (loop my-loop - [count 0 + [count +0 x init] - (if (< 10 count) + (if (< +10 count) (my-loop (inc count) (f x)) x)))} (let [?params (case tokens @@ -5497,14 +5497,14 @@ [(bit #1) "#1" [_ (#.Bit #1)]] [(bit #0) "#0" [_ (#.Bit #0)]] - [(int 123) "123" [_ (#.Int 123)]] - [(frac 123.0) "123.0" [_ (#.Frac 123.0)]] + [(int +123) "+123" [_ (#.Int +123)]] + [(frac +123.0) "+123.0" [_ (#.Frac +123.0)]] [(text "\n") "\"\\n\"" [_ (#.Text "\n")]] [(tag ["yolo" "lol"]) "#yolo.lol" [_ (#.Tag ["yolo" "lol"])]] [(identifier ["yolo" "lol"]) "yolo.lol" [_ (#.Identifier ["yolo" "lol"])]] - [(form (list (bit #1) (int 123))) "(#1 123)" (^ [_ (#.Form (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] - [(tuple (list (bit #1) (int 123))) "[#1 123]" (^ [_ (#.Tuple (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] - [(record (list [(bit #1) (int 123)])) "{#1 123}" (^ [_ (#.Record (list [[_ (#.Bit #1)] [_ (#.Int 123)]]))])] + [(form (list (bit #1) (int +123))) "(#1 +123)" (^ [_ (#.Form (list [_ (#.Bit #1)] [_ (#.Int +123)]))])] + [(tuple (list (bit #1) (int +123))) "[#1 +123]" (^ [_ (#.Tuple (list [_ (#.Bit #1)] [_ (#.Int +123)]))])] + [(record (list [(bit #1) (int +123)])) "{#1 +123}" (^ [_ (#.Record (list [[_ (#.Bit #1)] [_ (#.Int +123)]]))])] [(local-tag "lol") "#lol" [_ (#.Tag ["" "lol"])]] [(local-identifier "lol") "lol" [_ (#.Identifier ["" "lol"])]] )] @@ -5715,8 +5715,8 @@ (-> <type> Bit) (not (<even> n)))] - [Nat n/even? n/odd? n/% n/= +0 +2] - [Int i/even? i/odd? i/% i/= 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) (Meta (List Nat)) @@ -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 @@ -5765,11 +5765,11 @@ (def: #export (is? reference sample) {#.doc (doc "Tests whether the 2 values are identical (not just \"equal\")." "This one should succeed:" - (let [value 5] + (let [value +5] (is? value value)) "This one should fail:" - (is? 5 (i/+ 2 3)))} + (is? +5 (i/+ +2 +3)))} (All [a] (-> a a Bit)) ("lux is" reference sample)) @@ -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)) @@ -5807,7 +5807,7 @@ (macro: #export (:assume tokens) {#.doc (doc "Coerces the given expression to the type of whatever is expected." - (: Dinosaur (:assume (list 1 2 3))))} + (: Dinosaur (:assume (list +1 +2 +3))))} (case tokens (^ (list expr)) (do Monad<Meta> @@ -5833,7 +5833,7 @@ (macro: #export (:of tokens) {#.doc (doc "Generates the type corresponding to a given definition or variable." - (let [my-num (: Int 123)] + (let [my-num (: Int +123)] (:of my-num)) "==" Int)} @@ -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) @@ -6152,8 +6152,8 @@ (def: #export (i/mod param subject) (All [m] (-> Int Int Int)) (let [raw (i/% param subject)] - (if (i/< 0 raw) - (let [shift (if (i/< 0 param) i/- i/+)] + (if (i/< +0 raw) + (let [shift (if (i/< +0 param) i/- i/+)] (|> raw (shift param))) raw))) @@ -6170,21 +6170,21 @@ (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)) (def: #export (frac-to-rev input) (-> Frac Rev) - (let [abs (if (f/< 0.0 input) + (let [abs (if (f/< +0.0 input) (f/* -1.0 input) input)] (|> abs - (f/% 1.0) + (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) |