aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux.lux744
-rw-r--r--stdlib/source/lux/compiler/default/cache.lux2
-rw-r--r--stdlib/source/lux/compiler/default/init.lux12
-rw-r--r--stdlib/source/lux/compiler/default/name.lux2
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis.lux14
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux4
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis/inference.lux12
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis/scope.lux6
-rw-r--r--stdlib/source/lux/compiler/default/phase/analysis/structure.lux4
-rw-r--r--stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux10
-rw-r--r--stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux50
-rw-r--r--stdlib/source/lux/compiler/default/phase/synthesis.lux4
-rw-r--r--stdlib/source/lux/compiler/default/phase/synthesis/expression.lux6
-rw-r--r--stdlib/source/lux/compiler/default/phase/synthesis/function.lux10
-rw-r--r--stdlib/source/lux/compiler/default/phase/synthesis/loop.lux2
-rw-r--r--stdlib/source/lux/compiler/default/phase/translation.lux6
-rw-r--r--stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux30
-rw-r--r--stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux6
-rw-r--r--stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux36
-rw-r--r--stdlib/source/lux/compiler/default/reference.lux8
-rw-r--r--stdlib/source/lux/compiler/default/repl/type.lux2
-rw-r--r--stdlib/source/lux/compiler/default/syntax.lux58
-rw-r--r--stdlib/source/lux/compiler/meta/io/archive.lux2
-rw-r--r--stdlib/source/lux/concurrency/actor.lux4
-rw-r--r--stdlib/source/lux/concurrency/promise.lux2
-rw-r--r--stdlib/source/lux/concurrency/semaphore.lux18
-rw-r--r--stdlib/source/lux/control/comonad.lux6
-rw-r--r--stdlib/source/lux/control/concatenative.lux22
-rw-r--r--stdlib/source/lux/control/contract.lux6
-rw-r--r--stdlib/source/lux/control/equivalence.lux4
-rw-r--r--stdlib/source/lux/control/exception.lux2
-rw-r--r--stdlib/source/lux/control/monad.lux6
-rw-r--r--stdlib/source/lux/control/parser.lux8
-rw-r--r--stdlib/source/lux/control/pipe.lux62
-rw-r--r--stdlib/source/lux/control/writer.lux2
-rw-r--r--stdlib/source/lux/data/bit.lux4
-rw-r--r--stdlib/source/lux/data/collection/array.lux30
-rw-r--r--stdlib/source/lux/data/collection/bits.lux28
-rw-r--r--stdlib/source/lux/data/collection/dictionary.lux54
-rw-r--r--stdlib/source/lux/data/collection/dictionary/ordered.lux2
-rw-r--r--stdlib/source/lux/data/collection/list.lux76
-rw-r--r--stdlib/source/lux/data/collection/queue/priority.lux4
-rw-r--r--stdlib/source/lux/data/collection/row.lux58
-rw-r--r--stdlib/source/lux/data/collection/sequence.lux6
-rw-r--r--stdlib/source/lux/data/collection/set.lux4
-rw-r--r--stdlib/source/lux/data/collection/set/multi.lux22
-rw-r--r--stdlib/source/lux/data/collection/tree/rose.lux6
-rw-r--r--stdlib/source/lux/data/collection/tree/rose/zipper.lux8
-rw-r--r--stdlib/source/lux/data/color.lux140
-rw-r--r--stdlib/source/lux/data/error.lux8
-rw-r--r--stdlib/source/lux/data/format/binary.lux36
-rw-r--r--stdlib/source/lux/data/format/json.lux2
-rw-r--r--stdlib/source/lux/data/maybe.lux4
-rw-r--r--stdlib/source/lux/data/number.lux583
-rw-r--r--stdlib/source/lux/data/number/complex.lux50
-rw-r--r--stdlib/source/lux/data/number/i64.lux22
-rw-r--r--stdlib/source/lux/data/number/ratio.lux16
-rw-r--r--stdlib/source/lux/data/sum.lux20
-rw-r--r--stdlib/source/lux/data/text.lux18
-rw-r--r--stdlib/source/lux/data/text/buffer.lux4
-rw-r--r--stdlib/source/lux/data/text/lexer.lux4
-rw-r--r--stdlib/source/lux/data/text/regex.lux19
-rw-r--r--stdlib/source/lux/data/text/unicode.lux246
-rw-r--r--stdlib/source/lux/host.js.lux6
-rw-r--r--stdlib/source/lux/host.jvm.lux6
-rw-r--r--stdlib/source/lux/io.lux2
-rw-r--r--stdlib/source/lux/macro/code.lux2
-rw-r--r--stdlib/source/lux/macro/poly.lux36
-rw-r--r--stdlib/source/lux/macro/poly/equivalence.lux2
-rw-r--r--stdlib/source/lux/macro/poly/functor.lux8
-rw-r--r--stdlib/source/lux/macro/poly/json.lux10
-rw-r--r--stdlib/source/lux/math.lux58
-rw-r--r--stdlib/source/lux/math/modular.lux10
-rw-r--r--stdlib/source/lux/math/random.lux34
-rw-r--r--stdlib/source/lux/test.lux50
-rw-r--r--stdlib/source/lux/time/date.lux104
-rw-r--r--stdlib/source/lux/time/duration.lux56
-rw-r--r--stdlib/source/lux/time/instant.lux166
-rw-r--r--stdlib/source/lux/type.lux6
-rw-r--r--stdlib/source/lux/type/check.lux6
-rw-r--r--stdlib/source/lux/type/implicit.lux10
-rw-r--r--stdlib/source/lux/type/resource.lux2
-rw-r--r--stdlib/source/lux/type/unit.lux16
-rw-r--r--stdlib/source/lux/world/binary.lux70
-rw-r--r--stdlib/source/lux/world/net/udp.jvm.lux4
85 files changed, 1662 insertions, 1648 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)
diff --git a/stdlib/source/lux/compiler/default/cache.lux b/stdlib/source/lux/compiler/default/cache.lux
index 1b5f595fd..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 cac69ab89..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 50240a801..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 182e3c321..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 24ded5476..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 91e28a4ca..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 a3f7e926c..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 e4d6159fc..f894679ef 100644
--- a/stdlib/source/lux/compiler/default/phase/analysis/structure.lux
+++ b/stdlib/source/lux/compiler/default/phase/analysis/structure.lux
@@ -181,7 +181,7 @@
## the tuple represents the expectations of the user.
## If the type is for a 3-tuple, but a 5-tuple is provided, it
## is assumed that the user intended the following layout:
- ## [0, 1, [2, 3, 4]]
+ ## [+0, +1, [+2, +3, +4]]
## but that, for whatever reason, it was written in a flat
## way.
[tailT tailC]
@@ -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 2817fd55d..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 7f63118ea..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 8deb48ba8..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 edb2cc034..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 397ca2449..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 bfa69c7c6..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 f9b5dfbb4..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 fb03f3788..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)
@@ -91,17 +91,17 @@
(def: (bit::left-shift [subjectO paramO])
Binary
- (_.arithmetic-shift/2 (_.remainder/2 (_.int 64) paramO)
+ (_.arithmetic-shift/2 (_.remainder/2 (_.int +64) paramO)
subjectO))
(def: (bit::arithmetic-right-shift [subjectO paramO])
Binary
- (_.arithmetic-shift/2 (|> paramO (_.remainder/2 (_.int 64)) (_.*/2 (_.int -1)))
+ (_.arithmetic-shift/2 (|> paramO (_.remainder/2 (_.int +64)) (_.*/2 (_.int -1)))
subjectO))
(def: (bit::logical-right-shift [subjectO paramO])
Binary
- (runtime.bit//logical-right-shift (_.remainder/2 (_.int 64) paramO) subjectO))
+ (runtime.bit//logical-right-shift (_.remainder/2 (_.int +64) paramO) subjectO))
(def: bundle::bit
Bundle
@@ -209,7 +209,7 @@
(bundle.install "%" (binary int::%))
(bundle.install "=" (binary int::=))
(bundle.install "<" (binary int::<))
- (bundle.install "to-frac" (unary (|>> (_.//2 (_.float 1.0)))))
+ (bundle.install "to-frac" (unary (|>> (_.//2 (_.float +1.0)))))
(bundle.install "char" (unary int::char)))))
(def: bundle::frac
@@ -302,7 +302,7 @@
(def: (atom::read atom)
Unary
- (_.vector-ref/2 atom (_.int 0)))
+ (_.vector-ref/2 atom (_.int +0)))
(def: (atom::compare-and-swap [atomO oldO newO])
Trinary
@@ -332,7 +332,7 @@
## [[Processes]]
(def: (process::parallelism-level [])
Nullary
- (_.int 1))
+ (_.int +1))
(def: bundle::process
Bundle
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 113f6b325..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,14 +70,14 @@
(_.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)]))
bodyO))
(_.if (|> @num-args (_.>/2 arityO))
- (let [arity-args (runtime.slice (_.int 0) arityO @curried)
+ (let [arity-args (runtime.slice (_.int +0) arityO @curried)
output-func-args (runtime.slice arityO
(|> @num-args (_.-/2 arityO))
@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 607d922e4..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)])
@@ -114,14 +114,14 @@
(runtime: (slice offset length list)
(<| (_.if (_.null?/1 list)
list)
- (_.if (|> offset (_.>/2 (_.int 0)))
- (slice (|> offset (_.-/2 (_.int 1)))
+ (_.if (|> offset (_.>/2 (_.int +0)))
+ (slice (|> offset (_.-/2 (_.int +1)))
length
(_.cdr/1 list)))
- (_.if (|> length (_.>/2 (_.int 0)))
+ (_.if (|> length (_.>/2 (_.int +0)))
(_.cons/2 (_.car/1 list)
(slice offset
- (|> length (_.-/2 (_.int 1)))
+ (|> length (_.-/2 (_.int +1)))
(_.cdr/1 list))))
_.nil))
@@ -157,7 +157,7 @@
(def: minimum-index-length
(-> Expression Computation)
- (|>> (_.+/2 (_.int 1))))
+ (|>> (_.+/2 (_.int +1))))
(def: product-element
(-> Expression Expression Computation)
@@ -165,7 +165,7 @@
(def: (product-tail product)
(-> Expression Computation)
- (_.vector-ref/2 product (|> (_.length/1 product) (_.-/2 (_.int 1)))))
+ (_.vector-ref/2 product (|> (_.length/1 product) (_.-/2 (_.int +1)))))
(def: (updated-index min-length product)
(-> Expression Expression Computation)
@@ -202,7 +202,7 @@
(_.begin
(list (_.define @slice [(list) #.None]
(_.make-vector/1 (|> @product_length (_.-/2 index))))
- (_.vector-copy!/5 @slice (_.int 0) product index @product_length)
+ (_.vector-copy!/5 @slice (_.int +0) product index @product_length)
@slice)))))))
(runtime: (sum//get sum last? wanted-tag)
@@ -235,11 +235,11 @@
@@sum//get)))
(runtime: (bit//logical-right-shift shift input)
- (_.if (_.=/2 (_.int 0) shift)
+ (_.if (_.=/2 (_.int +0) shift)
input
(|> input
(_.arithmetic-shift/2 (_.*/2 (_.int -1) shift))
- (_.bit-and/2 (_.int (hex "7FFFFFFFFFFFFFFF"))))))
+ (_.bit-and/2 (_.int (hex "+7FFFFFFFFFFFFFFF"))))))
(def: runtime//bit
Computation
@@ -286,10 +286,10 @@
(runtime: (atom//compare-and-swap atom old new)
(with-vars [@temp]
- (_.let (list [@temp (_.vector-ref/2 atom (_.int 0))])
+ (_.let (list [@temp (_.vector-ref/2 atom (_.int +0))])
(_.if (_.eq?/2 old @temp)
(_.begin
- (list (_.vector-set!/3 atom (_.int 0) new)
+ (list (_.vector-set!/3 atom (_.int +0) new)
(_.bool #1)))
(_.bool #0)))))
@@ -300,7 +300,7 @@
(runtime: (box//write value box)
(_.begin
(list
- (_.vector-set!/3 box (_.int 0) value)
+ (_.vector-set!/3 box (_.int +0) value)
..unit)))
(def: runtime//box
@@ -309,7 +309,7 @@
(runtime: (io//current-time _)
(|> (_.apply/* (_.global "current-second") (list))
- (_.*/2 (_.int 1_000))
+ (_.*/2 (_.int +1_000))
_.exact/1))
(def: runtime//io
@@ -334,7 +334,7 @@
(_.set! process//incoming (_.cons/2 process process//incoming)))]
(_.begin
(list
- (_.if (_.=/2 (_.int 0) milli-seconds)
+ (_.if (_.=/2 (_.int +0) milli-seconds)
(process//future procedure)
(with-vars [@start @process @now @ignored]
(_.let (list [@start (io//current-time ..unit)])
diff --git a/stdlib/source/lux/compiler/default/reference.lux b/stdlib/source/lux/compiler/default/reference.lux
index 086c72810..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 b4a8735d8..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 e06590f2e..5b20dcff5 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)]
- (wrap (case (|> code (format "+") (:: number.Hex@Codec<Text,Nat> decode))
+ [code (l.between 1 4 l.hexadecimal)]
+ (wrap (case (:: number.Hex@Codec<Text,Nat> decode code)
(#.Right value)
- [(n/+ +2 (text.size code)) (text.from-code value)]
+ [(n/+ 2 (text.size code)) (text.from-code value)]
_
(undefined))))
@@ -207,6 +207,8 @@
(l.and l.decimal
(l.some rich-digit)))
+(def: sign^ (l.one-of "+-"))
+
(do-template [<name> <tag> <lexer> <codec>]
[(def: #export (<name> where)
(-> Cursor (l.Lexer [Cursor Code]))
@@ -221,8 +223,7 @@
[where (<tag> value)]]))))]
[int #.Int
- (l.and (p.default "" (l.one-of "-"))
- rich-digits^)
+ (l.and sign^ rich-digits^)
number.Codec<Text,Int>]
[rev #.Rev
@@ -251,7 +252,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)]])))
@@ -259,8 +260,7 @@
(def: (normal-nat where)
(-> Cursor (l.Lexer [Cursor Code]))
(do p.Monad<Parser>
- [chunk (l.and (l.one-of "+")
- rich-digits^)]
+ [chunk rich-digits^]
(case (:: number.Codec<Text,Nat> decode chunk)
(#.Left error)
(p.fail error)
@@ -278,14 +278,14 @@
(-> Cursor (l.Lexer [Cursor Code]))
(do p.Monad<Parser>
[chunk ($_ l.and
- (p.default "" (l.one-of "-"))
+ sign^
rich-digits^
(l.one-of ".")
rich-digits^
(p.default ""
($_ l.and
(l.one-of "eE")
- (p.default "" (l.one-of "+-"))
+ sign^
rich-digits^)))]
(case (:: number.Codec<Text,Frac> decode chunk)
(#.Left error)
@@ -317,9 +317,9 @@
_ (l.this? "/")
denominator frac-ratio-fragment
_ (p.assert "Denominator cannot be 0."
- (not (f/= 0.0 denominator)))]
+ (not (f/= +0.0 denominator)))]
(wrap (|> numerator
- (f/* (if signed? -1.0 1.0))
+ (f/* (if signed? -1.0 +1.0))
(f// denominator)))))]
(wrap [(update@ #.column (n/+ (text.size chunk)) where)
[where (#.Frac value)]])))
@@ -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 1c5924df7..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 30924c86d..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 f84b659ff..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 3be7fb431..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 211604dc7..23a059ae4 100644
--- a/stdlib/source/lux/control/comonad.lux
+++ b/stdlib/source/lux/control/comonad.lux
@@ -26,17 +26,17 @@
[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."
(let [square (function (_ n) (i/* n n))]
(be CoMonad<Stream>
- [inputs (iterate inc 2)]
+ [inputs (iterate inc +2)]
(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 ee4a78e13..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/contract.lux b/stdlib/source/lux/control/contract.lux
index 72aefd174..065829f44 100644
--- a/stdlib/source/lux/control/contract.lux
+++ b/stdlib/source/lux/control/contract.lux
@@ -19,8 +19,8 @@
{#.doc (doc "Pre-conditions."
"Given a test and an expression to run, only runs the expression if the test passes."
"Otherwise, an error is raised."
- (pre (i/= 4 (i/+ 2 2))
- (foo 123 456 789)))}
+ (pre (i/= +4 (i/+ +2 +2))
+ (foo +123 +456 +789)))}
(wrap (list (` (exec (assert! (~ (code.text (format "Pre-condition failed: " (%code test))))
(~ test))
(~ expr))))))
@@ -31,7 +31,7 @@
"If the predicate returns #1, returns the value of the expression."
"Otherwise, an error is raised."
(post i/even?
- (i/+ 2 2)))}
+ (i/+ +2 +2)))}
(with-gensyms [g!output]
(wrap (list (` (let [(~ g!output) (~ expr)]
(exec (assert! (~ (code.text (format "Post-condition failed: " (%code test))))
diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux
index dea0e3fa6..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 2a3cd92c0..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 09dd14237..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 32ef09784..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 ffdb78575..c23723f6d 100644
--- a/stdlib/source/lux/control/pipe.lux
+++ b/stdlib/source/lux/control/pipe.lux
@@ -16,12 +16,12 @@
(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)
- (i/+ 4)
- (new> 0 inc)))}
+ (|> +20
+ (i/* +3)
+ (i/+ +4)
+ (new> +0 inc)))}
(case (list.reverse tokens)
(^ (list& _ r-body))
(wrap (list (` (|> (~+ (list.reverse r-body))))))
@@ -31,7 +31,7 @@
(syntax: #export (let> binding body prev)
{#.doc (doc "Gives a name to the piped-argument, within the given expression."
- (|> 5
+ (|> +5
(let> X (i/+ X X))))}
(wrap (list (` (let [(~ binding) (~ prev)]
(~ body))))))
@@ -48,9 +48,9 @@
{branches (p.some (p.and body^ body^))})
{#.doc (doc "Branching for pipes."
"Both the tests and the bodies are piped-code, and must be given inside a tuple."
- (|> 5
- (cond> [i/even?] [(i/* 2)]
- [i/odd?] [(i/* 3)]
+ (|> +5
+ (cond> [i/even?] [(i/* +2)]
+ [i/odd?] [(i/* +3)]
[(new> -1)])))}
(with-gensyms [g!temp]
(wrap (list (` (with-expansions
@@ -71,8 +71,8 @@
prev)
{#.doc (doc "Loops for pipes."
"Both the testing and calculating steps are pipes and must be given inside tuples."
- (|> 1
- (loop> [(i/< 10)]
+ (|> +1
+ (loop> [(i/< +10)]
[inc])))}
(with-gensyms [g!temp]
(wrap (list (` (loop [(~ g!temp) (~ prev)]
@@ -85,10 +85,10 @@
prev)
{#.doc (doc "Monadic pipes."
"Each steps in the monadic computation is a pipe and must be given inside a tuple."
- (|> 5
+ (|> +5
(do> Monad<Identity>
- [(i/* 3)]
- [(i/+ 4)]
+ [(i/* +3)]
+ [(i/+ +4)]
[inc])))}
(with-gensyms [g!temp]
(case (list.reverse steps)
@@ -108,9 +108,9 @@
prev)
{#.doc (doc "Non-updating pipes."
"Will generate piped computations, but their results will not be used in the larger scope."
- (|> 5
+ (|> +5
(exec> [.nat %n log!])
- (i/* 10)))}
+ (i/* +10)))}
(with-gensyms [g!temp]
(wrap (list (` (let [(~ g!temp) (~ prev)]
(exec (|> (~ g!temp) (~+ body))
@@ -120,11 +120,11 @@
prev)
{#.doc (doc "Parallel branching for pipes."
"Allows to run multiple pipelines for a value and gives you a tuple of the outputs."
- (|> 5
- (tuple> [(i/* 10)]
- [dec (i// 2)]
+ (|> +5
+ (tuple> [(i/* +10)]
+ [dec (i// +2)]
[Int/encode]))
- "Will become: [50 2 \"5\"]")}
+ "Will become: [+50 +2 \"+5\"]")}
(with-gensyms [g!temp]
(wrap (list (` (let [(~ g!temp) (~ prev)]
[(~+ (list/map (function (_ body) (` (|> (~ g!temp) (~+ body))))
@@ -134,17 +134,17 @@
prev)
{#.doc (doc "Pattern-matching for pipes."
"The bodies of each branch are NOT pipes; just regular values."
- (|> 5
- (case> 0 "zero"
- 1 "one"
- 2 "two"
- 3 "three"
- 4 "four"
- 5 "five"
- 6 "six"
- 7 "seven"
- 8 "eight"
- 9 "nine"
+ (|> +5
+ (case> +0 "zero"
+ +1 "one"
+ +2 "two"
+ +3 "three"
+ +4 "four"
+ +5 "five"
+ +6 "six"
+ +7 "seven"
+ +8 "eight"
+ +9 "nine"
_ "???")))}
(wrap (list (` (case (~ prev)
(~+ (list/join (list/map (function (_ [pattern body]) (list pattern body))
diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux
index a93242297..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 65bfad034..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 1a9e191a8..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 988a5b1dc..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 49465c123..3d4e84207 100644
--- a/stdlib/source/lux/data/collection/dictionary.lux
+++ b/stdlib/source/lux/data/collection/dictionary.lux
@@ -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 9e9a2ea8d..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 2d74aad79..bbc649fb9 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')
- ("lux text concat" "+" output')
+ input' (n// 10 input)]
+ (if (n/= 0 input')
+ 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 ee1e5c1ca..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 1a12e3d9f..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,12 +338,12 @@
(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)})
{#.doc (doc "Row literals."
- (row 10 20 30 40))}
+ (row +10 +20 +30 +40))}
(wrap (list (` (from-list (list (~+ elems)))))))
## [Structures]
diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux
index 2f9cf3722..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)
@@ -138,7 +138,7 @@
{branches (p.some s.any)})
{#.doc (doc "Allows destructuring of sequences in pattern-matching expressions."
"Caveat emptor: Only use it for destructuring, and not for testing values within the sequences."
- (let [(^sequence& x y z _tail) (some-sequence-func 1 2 3)]
+ (let [(^sequence& x y z _tail) (some-sequence-func +1 +2 +3)]
(func x y z)))}
(with-gensyms [g!sequence]
(let [body+ (` (let [(~+ (list/join (list/map (function (_ pattern)
diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux
index ef39c98e0..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 eb8e914e3..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.lux b/stdlib/source/lux/data/collection/tree/rose.lux
index 62b65422a..fc25f414f 100644
--- a/stdlib/source/lux/data/collection/tree/rose.lux
+++ b/stdlib/source/lux/data/collection/tree/rose.lux
@@ -49,9 +49,9 @@
(syntax: #export (tree {root tree^})
{#.doc (doc "Tree literals."
- (tree Int [10 {20 {}
- 30 {}
- 40 {}}]))}
+ (tree Int [+10 {+20 {}
+ +30 {}
+ +40 {}}]))}
(wrap (list (` (~ (loop [[value children] root]
(` {#value (~ value)
#children (list (~+ (list/map recur children)))})))))))
diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux
index 4181bd406..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 8ff70f96c..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))
@@ -53,62 +53,62 @@
blue (scale-down blue)
max ($_ f/max red green blue)
min ($_ f/min red green blue)
- luminance (|> (f/+ max min) (f// 2.0))]
+ luminance (|> (f/+ max min) (f// +2.0))]
(if (f/= max min)
## Achromatic
- [0.0 0.0 luminance]
+ [+0.0 +0.0 luminance]
## Chromatic
(let [diff (|> max (f/- min))
saturation (|> diff
- (f// (if (f/> 0.5 luminance)
- (|> 2.0 (f/- max) (f/- min))
+ (f// (if (f/> +0.5 luminance)
+ (|> +2.0 (f/- max) (f/- min))
(|> max (f/+ min)))))
hue' (cond (f/= red max)
(|> green (f/- blue) (f// diff)
- (f/+ (if (f/< blue green) 6.0 0.0)))
+ (f/+ (if (f/< blue green) +6.0 +0.0)))
(f/= green max)
(|> blue (f/- red) (f// diff)
- (f/+ 2.0))
+ (f/+ +2.0))
## (f/= blue max)
(|> red (f/- green) (f// diff)
- (f/+ 4.0)))]
- [(|> hue' (f// 6.0))
+ (f/+ +4.0)))]
+ [(|> hue' (f// +6.0))
saturation
luminance]))))
(def: (hue-to-rgb p q t)
(-> Frac Frac Frac Frac)
- (let [t (cond (f/< 0.0 t) (f/+ 1.0 t)
- (f/> 1.0 t) (f/- 1.0 t)
+ (let [t (cond (f/< +0.0 t) (f/+ +1.0 t)
+ (f/> +1.0 t) (f/- +1.0 t)
## else
t)
- f2/3 (f// 3.0 2.0)]
- (cond (f/< (f// 6.0 1.0) t)
- (|> q (f/- p) (f/* 6.0) (f/* t) (f/+ p))
+ f2/3 (f// +3.0 +2.0)]
+ (cond (f/< (f// +6.0 +1.0) t)
+ (|> q (f/- p) (f/* +6.0) (f/* t) (f/+ p))
- (f/< (f// 2.0 1.0) t)
+ (f/< (f// +2.0 +1.0) t)
q
(f/< f2/3 t)
- (|> q (f/- p) (f/* (|> f2/3 (f/- t))) (f/* 6.0) (f/+ p))
+ (|> q (f/- p) (f/* (|> f2/3 (f/- t))) (f/* +6.0) (f/+ p))
## else
p)))
(def: #export (from-hsl [hue saturation luminance])
(-> [Frac Frac Frac] Color)
- (if (f/= 0.0 saturation)
+ (if (f/= +0.0 saturation)
## Achromatic
(let [intensity (scale-up luminance)]
(color [intensity intensity intensity]))
## Chromatic
- (let [q (if (f/< 0.5 luminance)
- (|> saturation (f/+ 1.0) (f/* luminance))
+ (let [q (if (f/< +0.5 luminance)
+ (|> saturation (f/+ +1.0) (f/* luminance))
(|> luminance (f/+ saturation) (f/- (f/* saturation luminance))))
- p (|> luminance (f/* 2.0) (f/- q))
- third (|> 1.0 (f// 3.0))]
+ p (|> luminance (f/* +2.0) (f/- q))
+ third (|> +1.0 (f// +3.0))]
(color [(scale-up (|> hue (f/+ third) (hue-to-rgb p q)))
(scale-up (|> hue (hue-to-rgb p q)))
(scale-up (|> hue (f/- third) (hue-to-rgb p q)))]))))
@@ -123,41 +123,41 @@
min ($_ f/min red green blue)
brightness max
diff (|> max (f/- min))
- saturation (if (f/= 0.0 max)
- 0.0
+ saturation (if (f/= +0.0 max)
+ +0.0
(|> diff (f// max)))]
(if (f/= max min)
## Achromatic
- [0.0 saturation brightness]
+ [+0.0 saturation brightness]
## Chromatic
(let [hue (cond (f/= red max)
(|> green (f/- blue) (f// diff)
- (f/+ (if (f/< blue green) 6.0 0.0)))
+ (f/+ (if (f/< blue green) +6.0 +0.0)))
(f/= green max)
(|> blue (f/- red) (f// diff)
- (f/+ 2.0))
+ (f/+ +2.0))
## (f/= blue max)
(|> red (f/- green) (f// diff)
- (f/+ 4.0)))]
- [(|> hue (f// 6.0))
+ (f/+ +4.0)))]
+ [(|> hue (f// +6.0))
saturation
brightness]))))
(def: #export (from-hsb [hue saturation brightness])
(-> [Frac Frac Frac] Color)
- (let [hue (|> hue (f/* 6.0))
+ (let [hue (|> hue (f/* +6.0))
i (math.floor hue)
f (|> hue (f/- i))
- p (|> 1.0 (f/- saturation) (f/* brightness))
- q (|> 1.0 (f/- (f/* f saturation)) (f/* brightness))
- t (|> 1.0 (f/- (|> 1.0 (f/- f) (f/* saturation))) (f/* brightness))
+ p (|> +1.0 (f/- saturation) (f/* brightness))
+ q (|> +1.0 (f/- (f/* f saturation)) (f/* brightness))
+ 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))]
+ 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))]
(color [(scale-up red)
(scale-up green)
(scale-up blue)])))
@@ -168,34 +168,34 @@
red (scale-down red)
green (scale-down green)
blue (scale-down blue)
- key (|> 1.0 (f/- ($_ f/max red green blue)))
- f (if (f/< 1.0 key)
- (|> 1.0 (f// (|> 1.0 (f/- key))))
- 0.0)
- cyan (|> 1.0 (f/- red) (f/- key) (f/* f))
- magenta (|> 1.0 (f/- green) (f/- key) (f/* f))
- yellow (|> 1.0 (f/- blue) (f/- key) (f/* f))]
+ key (|> +1.0 (f/- ($_ f/max red green blue)))
+ f (if (f/< +1.0 key)
+ (|> +1.0 (f// (|> +1.0 (f/- key))))
+ +0.0)
+ cyan (|> +1.0 (f/- red) (f/- key) (f/* f))
+ magenta (|> +1.0 (f/- green) (f/- key) (f/* f))
+ yellow (|> +1.0 (f/- blue) (f/- key) (f/* f))]
[cyan magenta yellow key]))
(def: #export (from-cmyk [cyan magenta yellow key])
(-> [Frac Frac Frac Frac] Color)
- (if (f/= 1.0 key)
- (color [+0 +0 +0])
- (let [red (|> (|> 1.0 (f/- cyan))
- (f/* (|> 1.0 (f/- key))))
- green (|> (|> 1.0 (f/- magenta))
- (f/* (|> 1.0 (f/- key))))
- blue (|> (|> 1.0 (f/- yellow))
- (f/* (|> 1.0 (f/- key))))]
+ (if (f/= +1.0 key)
+ (color [0 0 0])
+ (let [red (|> (|> +1.0 (f/- cyan))
+ (f/* (|> +1.0 (f/- key))))
+ green (|> (|> +1.0 (f/- magenta))
+ (f/* (|> +1.0 (f/- key))))
+ blue (|> (|> +1.0 (f/- yellow))
+ (f/* (|> +1.0 (f/- key))))]
(color [(scale-up red) (scale-up green) (scale-up blue)]))))
(def: (normalize ratio)
(-> Frac Frac)
- (cond (f/> 1.0 ratio)
- (f/% 1.0 ratio)
+ (cond (f/> +1.0 ratio)
+ (f/% +1.0 ratio)
- (f/< 0.0 ratio)
- (|> 1.0 (f/+ (f/% 1.0 ratio)))
+ (f/< +0.0 ratio)
+ (|> +1.0 (f/+ (f/% +1.0 ratio)))
## else
ratio))
@@ -203,7 +203,7 @@
(def: #export (interpolate ratio end start)
(-> Frac Color Color Color)
(let [dS (normalize ratio)
- dE (|> 1.0 (f/- dS))
+ dE (|> +1.0 (f/- dS))
interpolate' (: (-> Nat Nat Nat)
(function (_ end start)
(|> (|> start .int int-to-frac (f/* dS))
@@ -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>]
@@ -242,8 +242,8 @@
(let [[hue saturation luminance] (to-hsl color)]
(from-hsl [hue
(|> saturation
- (f/* (|> 1.0 (<op> (normalize ratio))))
- (f/min 1.0))
+ (f/* (|> +1.0 (<op> (normalize ratio))))
+ (f/min +1.0))
luminance])))]
[saturate f/+]
@@ -253,7 +253,7 @@
(def: #export (gray-scale color)
(-> Color Color)
(let [[_ _ luminance] (to-hsl color)]
- (from-hsl [0.0 0.0 luminance])))
+ (from-hsl [+0.0 +0.0 luminance])))
(do-template [<name> <1> <2>]
[(def: #export (<name> color)
@@ -263,9 +263,9 @@
(from-hsl [(|> hue (f/+ <1>) normalize) saturation luminance])
(from-hsl [(|> hue (f/+ <2>) normalize) saturation luminance])]))]
- [triad (|> 1.0 (f// 3.0)) (|> 2.0 (f// 3.0))]
- [clash (|> 1.0 (f// 4.0)) (|> 3.0 (f// 4.0))]
- [split-complement (|> 1.0 (f// 5.0)) (|> 3.0 (f// 5.0))]
+ [triad (|> +1.0 (f// +3.0)) (|> +2.0 (f// +3.0))]
+ [clash (|> +1.0 (f// +4.0)) (|> +3.0 (f// +4.0))]
+ [split-complement (|> +1.0 (f// +5.0)) (|> +3.0 (f// +5.0))]
)
(do-template [<name> <1> <2> <3>]
@@ -277,13 +277,13 @@
(from-hsl [(|> hue (f/+ <2>) normalize) saturation luminance])
(from-hsl [(|> hue (f/+ <3>) normalize) saturation luminance])]))]
- [square (|> 1.0 (f// 4.0)) (|> 2.0 (f// 4.0)) (|> 3.0 (f// 4.0))]
- [tetradic (|> 2.0 (f// 12.0)) (|> 6.0 (f// 12.0)) (|> 8.0 (f// 12.0))]
+ [square (|> +1.0 (f// +4.0)) (|> +2.0 (f// +4.0)) (|> +3.0 (f// +4.0))]
+ [tetradic (|> +2.0 (f// +12.0)) (|> +6.0 (f// +12.0)) (|> +8.0 (f// +12.0))]
)
(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))
+ slice (|> +1.0 (f// (|> results .int int-to-frac)))]
+ (|> (list.n/range 0 (dec results))
(list/map (|>> .int int-to-frac
(f/* slice)
(f/+ brightness)
diff --git a/stdlib/source/lux/data/error.lux b/stdlib/source/lux/data/error.lux
index 8054736e9..17d88a5a0 100644
--- a/stdlib/source/lux/data/error.lux
+++ b/stdlib/source/lux/data/error.lux
@@ -86,10 +86,10 @@
(macro: #export (default tokens compiler)
{#.doc (doc "Allows you to provide a default value that will be used"
"if a (Error x) value turns out to be #Error."
- (is? 10
- (default 20 (#Success 10)))
- (is? 20
- (default 20 (#Error "KABOOM!"))))}
+ (is? +10
+ (default +20 (#Success +10)))
+ (is? +20
+ (default +20 (#Error "KABOOM!"))))}
(case tokens
(^ (list else error))
(#Success [compiler (list (` (case (~ error)
diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux
index b2feda2c5..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/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 02c05f5dd..549631f2a 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -55,7 +55,7 @@
(syntax: #export (json token)
{#.doc (doc "A simple way to produce JSON literals."
(json #1)
- (json 123.456)
+ (json +123.456)
(json "Some text")
(json #null)
(json ["this" "is" "an" "array"])
diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux
index d6b44e02d..57ff95727 100644
--- a/stdlib/source/lux/data/maybe.lux
+++ b/stdlib/source/lux/data/maybe.lux
@@ -84,9 +84,9 @@
(macro: #export (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 ["" ""])])
diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux
index cb71b5b07..13ffe71da 100644
--- a/stdlib/source/lux/data/number.lux
+++ b/stdlib/source/lux/data/number.lux
@@ -10,7 +10,7 @@
interval
[codec (#+ Codec)]]
[data
- ["e" error]
+ ["." error (#+ Error)]
["." maybe]
["." text]]]
[/
@@ -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>]
@@ -74,8 +74,8 @@
<1>))
)]
- [ Int Order<Int> i/+ i/- i/* i// i/% i/= i/< 0 1 -1]
- [Frac Order<Frac> f/+ f/- f/* f// f/% f/= f/< 0.0 1.0 -1.0]
+ [ Int Order<Int> i/+ i/- i/* i// i/% i/= i/< +0 +1 -1]
+ [Frac Order<Frac> f/+ f/- f/* f// f/% f/= f/< +0.0 +1.0 -1.0]
)
(structure: #export _ (Number Rev)
@@ -107,10 +107,10 @@
(def: top <top>)
(def: bottom <bottom>))]
- [ Nat Enum<Nat> (:coerce Nat -1) +0]
- [ Int Enum<Int> 9_223_372_036_854_775_807 -9_223_372_036_854_775_808]
+ [ 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,16 +118,16 @@
(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/+]
- [ Mul@Monoid<Int> Int 1 i/*]
+ [ Add@Monoid<Int> Int +0 i/+]
+ [ Mul@Monoid<Int> Int +1 i/*]
[ Max@Monoid<Int> Int (:: Interval<Int> bottom) i/max]
[ Min@Monoid<Int> Int (:: Interval<Int> top) i/min]
- [Add@Monoid<Frac> Frac 0.0 f/+]
- [Mul@Monoid<Frac> Frac 1.0 f/*]
+ [Add@Monoid<Frac> Frac +0.0 f/+]
+ [Mul@Monoid<Frac> Frac +1.0 f/*]
[Max@Monoid<Frac> Frac (:: Interval<Frac> bottom) f/max]
[Min@Monoid<Frac> Frac (:: Interval<Frac> top) f/min]
[ Add@Monoid<Rev> Rev (:: Interval<Rev> bottom) r/+]
@@ -140,10 +140,10 @@
[(def: #export <name>
{#.doc <doc>}
Frac
- (f// 0.0 <numerator>))]
+ (f// +0.0 <numerator>))]
- [not-a-number 0.0 "Not a number."]
- [positive-infinity 1.0 "Positive infinity."]
+ [not-a-number +0.0 "Not a number."]
+ [positive-infinity +1.0 "Positive infinity."]
[negative-infinity -1.0 "Negative infinity."]
)
@@ -166,10 +166,10 @@
(def: (decode input)
(case (<decoder> [input])
(#.Some value)
- (#e.Success value)
+ (#error.Success value)
#.None
- (#e.Error <error>))))]
+ (#error.Error <error>))))]
[Frac "lux frac encode" "lux frac decode" "Could not decode Frac"]
)
@@ -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,98 +299,111 @@
(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
- (#e.Error ("lux text concat" <error> repr))
-
- (#.Some digit-value)
- (recur (inc idx)
- (|> output (n/* <base>) (n/+ digit-value)))))
- (#e.Success output)))
+ (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: "]
+ )
- _
- (#e.Error ("lux text concat" <error> repr)))
- (#e.Error ("lux text concat" <error> repr))))))]
+(def: (int/sign!! value)
+ (-> Int Text)
+ (if (i/< +0 value)
+ "-"
+ "+"))
- [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?? representation)
+ (-> Text (Maybe Int))
+ (case (get-char representation 0)
+ (^ (#.Some "-"))
+ (#.Some -1)
+
+ (^ (#.Some "+"))
+ (#.Some +1)
+
+ _
+ #.None))
+
+(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
+ output +0]
+ (if (n/< input-size idx)
+ (let [digit (maybe.assume (get-char repr idx))]
+ (case (<to-value> digit)
+ #.None
+ (#error.Error <error>)
+
+ (#.Some digit-value)
+ (recur (inc idx)
+ (|> output (i/* <base>) (i/+ (.int digit-value))))))
+ (#error.Success (i/* sign output)))))
(do-template [<struct> <base> <to-character> <to-value> <error>]
[(structure: #export <struct> (Codec Text Int)
(def: (encode value)
- (if (i/= 0 value)
- "0"
- (let [sign (if (i/< 0 value)
- "-"
- "")]
- (loop [input (|> value (i// <base>) (:: Number<Int> abs))
- output (|> value (i/% <base>) (:: Number<Int> abs) .nat
- <to-character>
- maybe.assume)]
- (if (i/= 0 input)
- ("lux text concat" sign output)
- (let [digit (maybe.assume (<to-character> (.nat (i/% <base> input))))]
- (recur (i// <base> input)
- ("lux text concat" digit output))))))))
+ (if (i/= +0 value)
+ "+0"
+ (loop [input (|> value (i// <base>) (:: Number<Int> abs))
+ output (|> value (i/% <base>) (:: Number<Int> abs) .nat
+ <to-character>
+ maybe.assume)]
+ (if (i/= +0 input)
+ ("lux text concat" (int/sign!! value) output)
+ (let [digit (maybe.assume (<to-character> (.nat (i/% <base> input))))]
+ (recur (i// <base> input)
+ ("lux text concat" digit output)))))))
(def: (decode repr)
(let [input-size ("lux text size" repr)]
- (if (n/>= +1 input-size)
- (let [sign (case (get-char repr +0)
- (^ (#.Some "-"))
- -1
-
- _
- 1)]
- (loop [idx (if (i/= -1 sign) +1 +0)
- output 0]
- (if (n/< input-size idx)
- (let [digit (maybe.assume (get-char repr idx))]
- (case (<to-value> digit)
- #.None
- (#e.Error <error>)
-
- (#.Some digit-value)
- (recur (inc idx)
- (|> output (i/* <base>) (i/+ (:coerce Int digit-value))))))
- (#e.Success (i/* sign output)))))
- (#e.Error <error>)))))]
-
- [Binary@Codec<Text,Int> 2 binary-character binary-value "Invalid binary syntax for Int: "]
- [Octal@Codec<Text,Int> 8 octal-character octal-value "Invalid octal syntax for Int: "]
- [_ 10 decimal-character decimal-value "Invalid syntax for Int: "]
- [Hex@Codec<Text,Int> 16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Int: "]
+ (if (n/> 1 input-size)
+ (case (int/sign?? repr)
+ (#.Some sign)
+ (int-decode-loop input-size repr sign <base> <to-value> <error>)
+
+ #.None
+ (#error.Error <error>))
+ (#error.Error <error>)))))]
+
+ [Binary@Codec<Text,Int> +2 binary-character binary-value "Invalid binary syntax for Int: "]
+ [Octal@Codec<Text,Int> +8 octal-character octal-value "Invalid octal syntax for Int: "]
+ [_ +10 decimal-character decimal-value "Invalid syntax for Int: "]
+ [Hex@Codec<Text,Int> +16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Int: "]
)
(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))))
@@ -399,20 +412,20 @@
(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)))
- (#e.Success output)])
- (#e.Success (:coerce Rev output))
+ [(:: <nat> decode (de-prefix repr))
+ (#error.Success output)])
+ (#error.Success (:coerce Rev output))
_
- (#e.Error ("lux text concat" <error> repr)))
- (#e.Error ("lux text concat" <error> repr))))))]
+ (#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>]
@@ -420,55 +433,55 @@
(def: (encode value)
(let [whole (frac-to-int value)
whole-part (:: <int> encode whole)
- decimal (:: Number<Frac> abs (f/% 1.0 value))
- decimal-part (if (f/= 0.0 decimal)
+ decimal (:: Number<Frac> abs (f/% +1.0 value))
+ decimal-part (if (f/= +0.0 decimal)
".0"
(loop [dec-left decimal
output ""]
- (if (f/= 0.0 dec-left)
+ (if (f/= +0.0 dec-left)
("lux text concat" "." output)
(let [shifted (f/* <base> dec-left)
digit (|> shifted (f/% <base>) frac-to-int .nat
(get-char <char-set>) maybe.assume)]
- (recur (f/% 1.0 shifted)
+ (recur (f/% +1.0 shifted)
("lux text concat" output digit))))))]
("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)]
- (^multi [(#e.Success whole) (#e.Success decimal)]
- (i/>= 0 decimal))
- (let [sign (if (i/< 0 whole)
+ (^multi [(#error.Success whole) (#error.Success decimal)]
+ (i/>= +0 decimal))
+ (let [sign (if (i/< +0 whole)
-1.0
- 1.0)
+ +1.0)
div-power (loop [muls-left ("lux text size" decimal-part)
- output 1.0]
- (if (n/= +0 muls-left)
+ output +1.0]
+ (if (n/= 0 muls-left)
output
(recur (dec muls-left)
(f/* <base> output))))
adjusted-decimal (|> decimal int-to-frac (f// div-power))
dec-rev (case (:: Hex@Codec<Text,Rev> decode ("lux text concat" "." decimal-part))
- (#e.Success dec-rev)
+ (#error.Success dec-rev)
dec-rev
- (#e.Error error)
+ (#error.Error error)
(error! error))]
- (#e.Success (f/+ (int-to-frac whole)
- (f/* sign adjusted-decimal))))
+ (#error.Success (f/+ (int-to-frac whole)
+ (f/* sign adjusted-decimal))))
_
- (#e.Error ("lux text concat" <error> repr))))
+ (#error.Error ("lux text concat" <error> repr))))
_
- (#e.Error ("lux text concat" <error> repr)))))]
+ (#error.Error ("lux text concat" <error> repr)))))]
- [Binary@Codec<Text,Frac> Binary@Codec<Text,Int> 2.0 "01" "Invalid binary syntax: "]
+ [Binary@Codec<Text,Frac> Binary@Codec<Text,Int> +2.0 "01" "Invalid binary syntax: "]
)
(def: (segment-digits chunk-size digits)
@@ -483,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)
@@ -575,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))))))
@@ -597,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>]
@@ -610,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)
@@ -622,29 +635,29 @@
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)
+ +1.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" ".")
("lux text concat" (<to> whole-part))
("lux text concat" (if (f/= -1.0 sign) "-" "")))]
(case (:: Binary@Codec<Text,Frac> decode as-binary)
- (#e.Error _)
- (#e.Error ("lux text concat" <error> repr))
+ (#error.Error _)
+ (#error.Error ("lux text concat" <error> repr))
output
output))
_
- (#e.Error ("lux text concat" <error> repr))))))]
+ (#error.Error ("lux text concat" <error> repr))))))]
[Octal@Codec<Text,Frac> "Invalid octaladecimal syntax: " binary-to-octal octal-to-binary]
[Hex@Codec<Text,Frac> "Invalid hexadecimal syntax: " binary-to-hex hex-to-binary]
@@ -661,17 +674,17 @@
description [cursor (#.Text ($_ "lux text concat"
encoding "\n"
underscore))]]
- (#e.Success [state (list (` (doc (~ description)
- (~ example-1)
- (~ example-2))))]))
+ (#error.Success [state (list (` (doc (~ description)
+ (~ example-1)
+ (~ example-2))))]))
_
- (#e.Error "Wrong syntax for \"encoding-doc\".")))
+ (#error.Error "Wrong syntax for \"encoding-doc\".")))
(def: (underscore-prefixed? number)
(-> Text Bit)
- (case ("lux text index" number "_" +0)
- (#.Some +0)
+ (case ("lux text index" number "_" 0)
+ (#.Some 0)
#1
_
@@ -687,36 +700,36 @@
(case tokens
(#.Cons [meta (#.Text repr')] #.Nil)
(if (underscore-prefixed? repr')
- (#e.Error <error>)
+ (#error.Error <error>)
(let [repr (clean-underscores repr')]
(case (:: <nat> decode repr)
- (#e.Success value)
- (#e.Success [state (list [meta (#.Nat value)])])
+ (#error.Success value)
+ (#error.Success [state (list [meta (#.Nat value)])])
- (^multi (#e.Error _)
- [(:: <int> decode repr) (#e.Success value)])
- (#e.Success [state (list [meta (#.Int value)])])
+ (^multi (#error.Error _)
+ [(:: <int> decode repr) (#error.Success value)])
+ (#error.Success [state (list [meta (#.Int value)])])
- (^multi (#e.Error _)
- [(:: <rev> decode repr) (#e.Success value)])
- (#e.Success [state (list [meta (#.Rev value)])])
+ (^multi (#error.Error _)
+ [(:: <rev> decode repr) (#error.Success value)])
+ (#error.Success [state (list [meta (#.Rev value)])])
- (^multi (#e.Error _)
- [(:: <frac> decode repr) (#e.Success value)])
- (#e.Success [state (list [meta (#.Frac value)])])
+ (^multi (#error.Error _)
+ [(:: <frac> decode repr) (#error.Success value)])
+ (#error.Success [state (list [meta (#.Frac value)])])
_
- (#e.Error <error>))))
+ (#error.Error <error>))))
_
- (#e.Error <error>)))]
+ (#error.Error <error>)))]
[bin Binary@Codec<Text,Nat> Binary@Codec<Text,Int> Binary@Codec<Text,Rev> Binary@Codec<Text,Frac>
"Invalid binary syntax."
- (encoding-doc "binary" (bin "11001001") (bin "11_00_10_01"))]
+ (encoding-doc "binary" (bin "+11001001") (bin "+11_00_10_01"))]
[oct Octal@Codec<Text,Nat> Octal@Codec<Text,Int> Octal@Codec<Text,Rev> Octal@Codec<Text,Frac>
"Invalid octal syntax."
- (encoding-doc "octal" (oct "615243") (oct "615_243"))]
+ (encoding-doc "octal" (oct "+615243") (oct "+615_243"))]
[hex Hex@Codec<Text,Nat> Hex@Codec<Text,Int> Hex@Codec<Text,Rev> Hex@Codec<Text,Frac>
"Invalid hexadecimal syntax."
(encoding-doc "hexadecimal" (hex "deadBEEF") (hex "dead_BEEF"))]
@@ -740,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)
@@ -753,23 +766,23 @@
(def: (digits-times-5! idx output)
(-> Nat Digits Digits)
(loop [idx idx
- carry +0
+ carry 0
output output]
- (if (i/>= 0 (:coerce Int idx))
+ (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))]
- (if (i/>= 0 (:coerce Int times))
+ (digits-put power 1))]
+ (if (i/>= +0 (:coerce Int times))
(recur (dec times)
(digits-times-5! power output))
output)))
@@ -779,9 +792,9 @@
(loop [idx (dec i64.width)
all-zeroes? #1
output ""]
- (if (i/>= 0 (:coerce Int idx))
+ (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)
@@ -796,27 +809,27 @@
(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))
+ (if (i/>= +0 (:coerce Int idx))
(let [raw ($_ n/+
carry
(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
@@ -828,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)]
@@ -842,17 +855,17 @@
(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)
(loop [idx (dec i64.width)
output subject]
- (if (i/>= 0 (.int idx))
+ (if (i/>= +0 (.int idx))
(recur (dec idx)
(digits-sub-once! idx (digits-get idx param) output))
output)))
@@ -861,11 +874,11 @@
(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 [])]
- (if (i/>= 0 (:coerce Int idx))
+ (if (i/>= +0 (:coerce Int idx))
(if (i64.set? idx input)
(let [digits' (digits-add (digits-power (n/- idx last-idx))
digits)]
@@ -878,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)
@@ -901,70 +914,70 @@
(recur (digits-sub! power digits)
(inc idx)
(i64.set (n/- idx (dec i64.width)) output))))
- (#e.Success (:coerce Rev output))))
+ (#error.Success (:coerce Rev output))))
#.None
- (#e.Error ("lux text concat" "Wrong syntax for Rev: " input)))
- (#e.Error ("lux text concat" "Wrong syntax for Rev: " input))))
+ (#error.Error ("lux text concat" "Wrong syntax for Rev: " input)))
+ (#error.Error ("lux text concat" "Wrong syntax for Rev: " input))))
))
(def: (log2 input)
(-> Frac Frac)
- (f// ("lux math log" 2.0)
+ (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)]
+ (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))
+ (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)
+ (f/* ("lux math pow" +2.0 +52.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)
@@ -972,28 +985,28 @@
(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)
- 0.0
- (f/* -1.0 0.0))
+ (and (n/= 0 E) (n/= 0 M))
+ (if (n/= 0 S)
+ +0.0
+ (f/* -1.0 +0.0))
## else
(let [normalized (|> M (i64.set mantissa-size)
.int int-to-frac
- (f// ("lux math pow" 2.0 52.0)))
+ (f// ("lux math pow" +2.0 +52.0)))
power (|> E (n/- double-bias)
.int int-to-frac
- ("lux math pow" 2.0))
+ ("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 cc725925b..cd785fb31 100644
--- a/stdlib/source/lux/data/number/complex.lux
+++ b/stdlib/source/lux/data/number/complex.lux
@@ -27,14 +27,14 @@
"The imaginary part can be omitted if it's 0."
(complex real))}
(wrap (list (` {#..real (~ real)
- #..imaginary (~ (maybe.default (' 0.0)
+ #..imaginary (~ (maybe.default (' +0.0)
?imaginary))}))))
-(def: #export i Complex (complex 0.0 1.0))
+(def: #export i Complex (complex +0.0 +1.0))
-(def: #export one Complex (complex 1.0 0.0))
+(def: #export one Complex (complex +1.0 +0.0))
-(def: #export zero Complex (complex 0.0 0.0))
+(def: #export zero Complex (complex +0.0 +0.0))
(def: #export (not-a-number? complex)
(or (number.not-a-number? (get@ #real complex))
@@ -158,8 +158,8 @@
(def: #export (tan subject)
(-> Complex Complex)
(let [(^slots [#real #imaginary]) subject
- r2 (f/* 2.0 real)
- i2 (f/* 2.0 imaginary)
+ r2 (f/* +2.0 real)
+ i2 (f/* +2.0 imaginary)
d (f/+ (math.cos r2) (math.cosh i2))]
{#real (f// d (math.sin r2))
#imaginary (f// d (math.sinh i2))}))
@@ -167,8 +167,8 @@
(def: #export (tanh subject)
(-> Complex Complex)
(let [(^slots [#real #imaginary]) subject
- r2 (f/* 2.0 real)
- i2 (f/* 2.0 imaginary)
+ r2 (f/* +2.0 real)
+ i2 (f/* +2.0 imaginary)
d (f/+ (math.cosh r2) (math.cos i2))]
{#real (f// d (math.sinh r2))
#imaginary (f// d (math.sin i2))}))
@@ -178,15 +178,15 @@
(let [(^slots [#real #imaginary]) subject]
(complex (if (f/< (frac/abs imaginary)
(frac/abs real))
- (if (f/= 0.0 imaginary)
+ (if (f/= +0.0 imaginary)
(frac/abs real)
(let [q (f// imaginary real)]
- (f/* (math.pow 0.5 (f/+ 1.0 (f/* q q)))
+ (f/* (math.pow +0.5 (f/+ +1.0 (f/* q q)))
(frac/abs imaginary))))
- (if (f/= 0.0 real)
+ (if (f/= +0.0 real)
(frac/abs imaginary)
(let [q (f// real imaginary)]
- (f/* (math.pow 0.5 (f/+ 1.0 (f/* q q)))
+ (f/* (math.pow +0.5 (f/+ +1.0 (f/* q q)))
(frac/abs real))))
))))
@@ -234,18 +234,18 @@
(def: #export (root2 (^@ input (^slots [#real #imaginary])))
(-> Complex Complex)
- (let [t (|> input ..abs (get@ #real) (f/+ (frac/abs real)) (f// 2.0) (math.pow 0.5))]
- (if (f/>= 0.0 real)
+ (let [t (|> input ..abs (get@ #real) (f/+ (frac/abs real)) (f// +2.0) (math.pow +0.5))]
+ (if (f/>= +0.0 real)
{#real t
- #imaginary (f// (f/* 2.0 t)
+ #imaginary (f// (f/* +2.0 t)
imaginary)}
- {#real (f// (f/* 2.0 t)
+ {#real (f// (f/* +2.0 t)
(frac/abs imaginary))
- #imaginary (f/* t (copy-sign imaginary 1.0))})))
+ #imaginary (f/* t (copy-sign imaginary +1.0))})))
(def: #export (root2-1z input)
(-> Complex Complex)
- (|> (complex 1.0) (- (* input input)) root2))
+ (|> (complex +1.0) (- (* input input)) root2))
(def: #export (reciprocal (^slots [#real #imaginary]))
(-> Complex Complex)
@@ -253,12 +253,12 @@
(frac/abs real))
(let [q (f// imaginary real)
scale (f// (|> real (f/* q) (f/+ imaginary))
- 1.0)]
+ +1.0)]
{#real (f/* q scale)
#imaginary (frac/negate scale)})
(let [q (f// real imaginary)
scale (f// (|> imaginary (f/* q) (f/+ real))
- 1.0)]
+ +1.0)]
{#real scale
#imaginary (|> scale frac/negate (f/* q))})))
@@ -283,7 +283,7 @@
(+ i)
(/ (- input i))
log
- (* (/ (complex 2.0) i))))
+ (* (/ (complex +2.0) i))))
(def: #export (argument (^slots [#real #imaginary]))
(-> Complex Frac)
@@ -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-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))
+ slice (|> math.pi (f/* +2.0) (f// r-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 32b9df2e3..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 0562dec72..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 670951182..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 28679b429..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 f8042abc0..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 6e16ee6ec..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 2e4087b23..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^
@@ -183,8 +183,7 @@
(def: number^
(l.Lexer Nat)
(|> (l.many l.decimal)
- (p.codec number.Codec<Text,Int>)
- (parser/map .nat)))
+ (p.codec number.Codec<Text,Nat>)))
(def: re-back-reference^
(l.Lexer Code)
@@ -289,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!
@@ -298,13 +297,13 @@
(' #let) (` [(~ g!total) (:: (~! text.Monoid<Text>) (~' compose) (~ g!total) (~ access))]))
steps)])
)))
- [0
+ [+0
(: (List Code) (list))
(: (List (List Code)) (list))]
parts)]]
(wrap [(if capturing?
(list.size names)
- +0)
+ 0)
(` (do p.Monad<Parser>
[(~ (' #let)) [(~ g!total) ""]
(~+ (|> steps list.reverse list/join))]
@@ -320,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)))))
@@ -347,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 c9796158d..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.js.lux b/stdlib/source/lux/host.js.lux
index d074b1ff1..0302064b3 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -30,7 +30,7 @@
## [Syntax]
(syntax: #export (set! field-name field-value object)
{#.doc (doc "A way to set fields from objects."
- (set! "foo" 1234 some-object))}
+ (set! "foo" +1234 some-object))}
(wrap (list (` ("js set-field" (~ object) (~ field-name) (~ field-value))))))
(syntax: #export (delete! field-name object)
@@ -75,8 +75,8 @@
(syntax: #export (call! {shape (p.or ($_ p.and s.any (s.tuple (p.some s.any)) (p.maybe s.any))
($_ p.and s.any s.text (s.tuple (p.some s.any)) (p.maybe s.any)))})
{#.doc (doc "A way to call JavaScript functions and methods."
- (call! (ref "Math.ceil") [123.45])
- (call! (ref "Math") "ceil" [123.45]))}
+ (call! (ref "Math.ceil") [+123.45])
+ (call! (ref "Math") "ceil" [+123.45]))}
(case shape
(#.Left [function args ?type])
(wrap (list (` (:coerce (~ (default (' ..Object) ?type))
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index cd0eaafed..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 f772f60fa..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 f6896343c..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 97ec08ff7..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 cb9280506..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 d28e98337..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 31ae2fdff..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 499a83e3e..cdaf54461 100644
--- a/stdlib/source/lux/math.lux
+++ b/stdlib/source/lux/math.lux
@@ -19,9 +19,9 @@
Frac
<value>)]
- [e 2.7182818284590452354 "The base of the natural logarithm."]
- [pi 3.14159265358979323846 "The ratio of a circle's circumference to its diameter."]
- [tau 6.28318530717958647692 "The ratio of a circle's circumference to its radius."]
+ [e +2.7182818284590452354 "The base of the natural logarithm."]
+ [pi +3.14159265358979323846 "The ratio of a circle's circumference to its diameter."]
+ [tau +6.28318530717958647692 "The ratio of a circle's circumference to its radius."]
)
(do-template [<name> <method>]
@@ -48,8 +48,8 @@
(-> Frac Frac)
(let [floored (floor input)
diff (f/- floored input)]
- (cond (f/> 0.5 diff)
- (f/+ 1.0 floored)
+ (cond (f/> +0.5 diff)
+ (f/+ +1.0 floored)
(f/< -0.5 diff)
(f/+ -1.0 floored)
@@ -63,22 +63,22 @@
(def: #export (atan2 param subject)
(-> Frac Frac Frac)
- (cond (f/> 0.0 param)
+ (cond (f/> +0.0 param)
(atan (f// param subject))
- (f/< 0.0 param)
- (if (f/>= 0.0 subject)
+ (f/< +0.0 param)
+ (if (f/>= +0.0 subject)
(|> subject (f// param) atan (f/+ pi))
(|> subject (f// param) atan (f/- pi)))
- ## (f/= 0.0 param)
- (cond (f/> 0.0 subject)
- (|> pi (f// 2.0))
+ ## (f/= +0.0 param)
+ (cond (f/> +0.0 subject)
+ (|> pi (f// +2.0))
- (f/< 0.0 subject)
+ (f/< +0.0 subject)
(|> pi (f// -2.0))
- ## (f/= 0.0 subject)
+ ## (f/= +0.0 subject)
number.not-a-number)))
(def: #export (log' base input)
@@ -88,16 +88,16 @@
(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)))))
(def: #export (hypotenuse catA catB)
(-> Frac Frac Frac)
- (pow 0.5 (f/+ (pow 2.0 catA)
- (pow 2.0 catB))))
+ (pow +0.5 (f/+ (pow +2.0 catA)
+ (pow +2.0 catB))))
(do-template [<type> <mod> <gcd> <lcm> <zero> <*> </> <->]
[(def: #export (<gcd> a b)
@@ -118,8 +118,8 @@
(|> a (</> (<gcd> a b)) (<*> b))
))]
- [Nat n/mod n/gcd n/lcm +0 n/* n// n/-]
- [Int i/mod i/gcd i/lcm 0 i/* i// i/-]
+ [Nat n/mod n/gcd n/lcm 0 n/* n// n/-]
+ [Int i/mod i/gcd i/lcm +0 i/* i// i/-]
)
## Hyperbolic functions
@@ -127,11 +127,11 @@
(do-template [<name> <comp> <inverse>]
[(def: #export (<name> x)
(-> Frac Frac)
- (|> (exp x) (<comp> (exp (f/* -1.0 x))) (f// 2.0)))
+ (|> (exp x) (<comp> (exp (f/* -1.0 x))) (f// +2.0)))
(def: #export (<inverse> x)
(-> Frac Frac)
- (|> 2.0 (f// (|> (exp x) (<comp> (exp (f/* -1.0 x)))))))]
+ (|> +2.0 (f// (|> (exp x) (<comp> (exp (f/* -1.0 x)))))))]
[sinh f/- csch]
[cosh f/+ sech]
@@ -154,7 +154,7 @@
(do-template [<name> <comp>]
[(def: #export (<name> x)
(-> Frac Frac)
- (|> x (pow 2.0) (<comp> 1.0) (pow 0.5) (f/+ x) log))]
+ (|> x (pow +2.0) (<comp> +1.0) (pow +0.5) (f/+ x) log))]
[asinh f/+]
[acosh f/-]
@@ -165,17 +165,17 @@
(-> Frac Frac)
(let [x+ (|> <base> (f/+ <diff>))
x- (|> <base> (f/- <diff>))]
- (|> x+ (f// x-) log (f// 2.0))))]
+ (|> x+ (f// x-) log (f// +2.0))))]
- [atanh 1.0 x]
- [acoth x 1.0]
+ [atanh +1.0 x]
+ [acoth x +1.0]
)
(do-template [<name> <op>]
[(def: #export (<name> x)
(-> Frac Frac)
- (let [x^2 (|> x (pow 2.0))]
- (|> 1.0 (<op> x^2) (pow 0.5) (f/+ 1.0) (f// x) log)))]
+ (let [x^2 (|> x (pow +2.0))]
+ (|> +1.0 (<op> x^2) (pow +0.5) (f/+ +1.0) (f// x) log)))]
[asech f/-]
[acsch f/+]
@@ -246,12 +246,12 @@
(syntax: #export (infix {expr infix^})
{#.doc (doc "Infix math syntax."
- (infix [x i/* 10])
+ (infix [x i/* +10])
(infix [[x i/+ y] i/* [x i/- y]])
(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/modular.lux b/stdlib/source/lux/math/modular.lux
index 092b18944..ef0f36bb2 100644
--- a/stdlib/source/lux/math/modular.lux
+++ b/stdlib/source/lux/math/modular.lux
@@ -26,7 +26,7 @@
(def: #export (from-int value)
(Ex [m] (-> Int (Error (Modulus m))))
- (if (i/= 0 value)
+ (if (i/= +0 value)
(ex.throw zero-cannot-be-a-modulus [])
(#e.Success (:abstraction value))))
@@ -52,7 +52,7 @@
(|> sample
(i/- reference)
(i/% (to-int modulus))
- (i/= 0)))
+ (i/= +0)))
(syntax: #export (modulus {modulus s.int})
(case (from-int modulus)
@@ -144,8 +144,8 @@
(def: (i/gcd+ a b)
(-> Int Int [Int Int Int])
- (if (i/= 0 a)
- [0 1 b]
+ (if (i/= +0 a)
+ [+0 +1 b]
(let [[ak bk gcd] (i/gcd+ (i/% a b) a)]
[(i/- (i/* ak
(i// a b))
@@ -158,7 +158,7 @@
(let [[value modulus] (:representation modular)
_modulus (to-int modulus)
[vk mk gcd] (i/gcd+ value _modulus)
- co-prime? (i/= 1 gcd)]
+ co-prime? (i/= +1 gcd)]
(if co-prime?
(#.Some (mod modulus vk))
#.None)))
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux
index 340cb1baa..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 8bb0a71a3..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
@@ -126,23 +126,23 @@
(context: "Simple macros and constructs"
($_ seq
(test "Can write easy loops for iterative programming."
- (i/= 1000
- (loop [counter 0
- value 1]
- (if (i/< 3 counter)
- (recur (inc counter) (i/* 10 value))
+ (i/= +1000
+ (loop [counter +0
+ value +1]
+ (if (i/< +3 counter)
+ (recur (inc counter) (i/* +10 value))
value))))
(test "Can create lists easily through macros."
- (and (case (list 1 2 3)
- (#.Cons 1 (#.Cons 2 (#.Cons 3 #.Nil)))
+ (and (case (list +1 +2 +3)
+ (#.Cons +1 (#.Cons +2 (#.Cons +3 #.Nil)))
#1
_
#0)
- (case (list& 1 2 3 (list 4 5 6))
- (#.Cons 1 (#.Cons 2 (#.Cons 3 (#.Cons 4 (#.Cons 5 (#.Cons 6 #.Nil))))))
+ (case (list& +1 +2 +3 (list +4 +5 +6))
+ (#.Cons +1 (#.Cons +2 (#.Cons +3 (#.Cons +4 (#.Cons +5 (#.Cons +6 #.Nil))))))
#1
_
@@ -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)]
@@ -217,8 +217,8 @@
(def: (success-message successes failures)
(-> Nat Nat Text)
(format "Test-suite finished." "\n"
- (%i (.int successes)) " out of " (%i (.int (n/+ failures successes))) " tests passed." "\n"
- (%i (.int failures)) " tests failed." "\n"))
+ (%n successes) " out of " (%n (n/+ failures successes)) " tests passed." "\n"
+ (%n failures) " tests failed." "\n"))
(syntax: #export (run)
{#.doc (doc "Runs all the tests defined on the current module, and in all imported modules."
@@ -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,9 +248,9 @@
list/join))]
(exec (log! ((~! success-message) (~ g!total-successes) (~ g!total-failures)))
((~! promise.future)
- ((~! io.exit) (if (n/> +0 (~ g!total-failures))
- 1
- 0)))))
+ ((~! io.exit) (if (n/> 0 (~ g!total-failures))
+ +1
+ +0)))))
[])))))))))
(def: #export (seq left right)
diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux
index ca5ea55b4..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>)
@@ -223,7 +223,7 @@
## Based on this: https://stackoverflow.com/a/42936293/6823464
(def: (pad value)
(-> Int Text)
- (if (i/< 10 value)
+ (if (i/< +10 value)
(text/compose "0" (int/encode value))
(int/encode value)))
@@ -237,43 +237,43 @@
(def: lex-year
(l.Lexer Int)
(do p.Monad<Parser>
- [sign? (p.maybe (l.this "-"))
+ [sign (p.or (l.this "-") (l.this "+"))
raw-year (p.codec number.Codec<Text,Int> (l.many l.decimal))
- #let [signum (case sign?
- #.None 1
- (#.Some _) -1)]]
+ #let [signum (case sign
+ (#.Left _) -1
+ (#.Right _) +1)]]
(wrap (i/* signum raw-year))))
(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)
- (|> (i// 4 year)
- (i/- (i// 100 year))
- (i/+ (i// 400 year))))
+ (|> (i// +4 year)
+ (i/- (i// +100 year))
+ (i/+ (i// +400 year))))
(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)
- (|> input (i/% factor) (i/= 0)))
+ (|> input (i/% factor) (i/= +0)))
(def: (leap-year? year)
(-> Int Bit)
- (and (divisible? 4 year)
- (or (not (divisible? 100 year))
- (divisible? 400 year))))
+ (and (divisible? +4 year)
+ (or (not (divisible? +100 year))
+ (divisible? +400 year))))
## Based on: https://stackoverflow.com/a/3309340/6823464
(def: lex-date
@@ -283,8 +283,8 @@
_ (l.this "-")
utc-month lex-section
_ (p.assert "Invalid month."
- (and (i/>= 1 utc-month)
- (i/<= 12 utc-month)))
+ (and (i/>= +1 utc-month)
+ (i/<= +12 utc-month)))
#let [months (if (leap-year? utc-year)
leap-year-months
normal-months)
@@ -294,22 +294,22 @@
_ (l.this "-")
utc-day lex-section
_ (p.assert "Invalid day."
- (and (i/>= 1 utc-day)
+ (and (i/>= +1 utc-day)
(i/<= (.int month-days) utc-day)))]
(wrap {#year utc-year
#month (case utc-month
- 1 #January
- 2 #February
- 3 #March
- 4 #April
- 5 #May
- 6 #June
- 7 #July
- 8 #August
- 9 #September
- 10 #October
- 11 #November
- 12 #December
+ +1 #January
+ +2 #February
+ +3 #March
+ +4 #April
+ +5 #May
+ +6 #June
+ +7 #July
+ +8 #August
+ +9 #September
+ +10 #October
+ +11 #November
+ +12 #December
_ (undefined))
#day (.nat utc-day)})))
diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux
index 0588d7ba2..1abac1cc0 100644
--- a/stdlib/source/lux/time/duration.lux
+++ b/stdlib/source/lux/time/duration.lux
@@ -63,21 +63,21 @@
(do-template [<name> <op>]
[(def: #export (<name> duration)
(-> Duration Bit)
- (<op> 0 (:representation duration)))]
+ (<op> +0 (:representation duration)))]
[positive? i/>]
[negative? i/<]
[neutral? i/=])
)
-(def: #export empty Duration (from-millis 0))
-(def: #export milli Duration (from-millis 1))
-(def: #export second Duration (scale 1_000 milli))
-(def: #export minute Duration (scale 60 second))
-(def: #export hour Duration (scale 60 minute))
-(def: #export day Duration (scale 24 hour))
-(def: #export week Duration (scale 7 day))
-(def: #export normal-year Duration (scale 365 day))
+(def: #export empty Duration (from-millis +0))
+(def: #export milli Duration (from-millis +1))
+(def: #export second Duration (scale +1_000 milli))
+(def: #export minute Duration (scale +60 second))
+(def: #export hour Duration (scale +60 minute))
+(def: #export day Duration (scale +24 hour))
+(def: #export week Duration (scale +7 day))
+(def: #export normal-year Duration (scale +365 day))
(def: #export leap-year Duration (merge day normal-year))
(structure: #export _ (Monoid Duration)
@@ -87,7 +87,7 @@
(def: (encode duration)
(-> Duration Text)
(if (:: Equivalence<Duration> = empty duration)
- "0ms"
+ "+0ms"
(let [signed? (negative? duration)
[days time-left] [(query day duration) (frame day duration)]
days (if signed?
@@ -102,38 +102,44 @@
millis (to-millis time-left)]
($_ text/compose
(if signed? "-" "")
- (if (i/= 0 days) "" (text/compose (int/encode days) "D"))
- (if (i/= 0 hours) "" (text/compose (int/encode hours) "h"))
- (if (i/= 0 minutes) "" (text/compose (int/encode minutes) "m"))
- (if (i/= 0 seconds) "" (text/compose (int/encode seconds) "s"))
- (if (i/= 0 millis) "" (text/compose (int/encode millis) "ms"))
+ (if (i/= +0 days) "" (text/compose (int/encode days) "D"))
+ (if (i/= +0 hours) "" (text/compose (int/encode hours) "h"))
+ (if (i/= +0 minutes) "" (text/compose (int/encode minutes) "m"))
+ (if (i/= +0 seconds) "" (text/compose (int/encode seconds) "s"))
+ (if (i/= +0 millis) "" (text/compose (int/encode millis) "ms"))
))))
(def: (lex-section suffix)
(-> Text (l.Lexer Int))
(|> (p.codec number.Codec<Text,Int> (l.many l.decimal))
(p.before (p.and (l.this suffix) (p.not l.alpha)))
- (p.default 0)))
+ (p.default +0)))
(def: lex-duration
(l.Lexer Duration)
(do p.Monad<Parser>
- [signed? (l.this? "-")
- #let [sign (function (_ raw) (if signed? (i/* -1 raw) raw))]
+ [signed? (p.or (l.this? "-") (l.this? "+"))
+ #let [sign (function (_ raw)
+ (case signed?
+ (#.Left _)
+ (i/* -1 raw)
+
+ (#.Right _)
+ raw))]
utc-day (lex-section "D")
utc-hour (lex-section "h")
utc-minute (lex-section "m")
_ (p.assert "Invalid minute."
- (and (i/>= 0 utc-minute)
- (i/<= 59 utc-minute)))
+ (and (i/>= +0 utc-minute)
+ (i/<= +59 utc-minute)))
utc-second (lex-section "s")
_ (p.assert "Invalid second."
- (and (i/>= 0 utc-second)
- (i/<= 59 utc-second)))
+ (and (i/>= +0 utc-second)
+ (i/<= +59 utc-second)))
utc-millis (lex-section "ms")
_ (p.assert "Invalid milli-seconds."
- (and (i/>= 0 utc-millis)
- (i/<= 999 utc-millis)))]
+ (and (i/>= +0 utc-millis)
+ (i/<= +999 utc-millis)))]
(wrap (|> empty
(merge (scale (sign utc-day) day))
(merge (scale (sign utc-hour) hour))
@@ -146,7 +152,7 @@
(l.run input lex-duration))
(structure: #export _
- {#.doc "For example: 15D21h14m51s827ms"}
+ {#.doc "For example: +15D21h14m51s827ms"}
(Codec Text Duration)
(def: encode encode)
(def: decode decode))
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index ea834391e..d6c506218 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -77,20 +77,20 @@
(def: #export epoch
{#.doc "The instant corresponding to 1970-01-01T00:00:00Z"}
Instant
- (from-millis 0))
+ (from-millis +0))
## Codec::encode
(def: (divisible? factor input)
(-> Int Int Bit)
- (|> input (i/% factor) (i/= 0)))
+ (|> input (i/% factor) (i/= +0)))
(def: (leap-year? year)
(-> Int Bit)
- (and (divisible? 4 year)
- (or (not (divisible? 100 year))
- (divisible? 400 year))))
+ (and (divisible? +4 year)
+ (or (not (divisible? +100 year))
+ (divisible? +400 year))))
-(def: epoch-year Int 1970)
+(def: epoch-year Int +1970)
(def: (find-year now)
(-> Instant [Int duration.Duration])
@@ -99,7 +99,7 @@
(let [year (if (leap-year? reference)
duration.leap-year
duration.normal-year)]
- (if (i/= 0 (duration.query year time-left))
+ (if (i/= +0 (duration.query year time-left))
[reference time-left]
(if (duration/>= duration.empty time-left)
(recur (inc reference) (duration.merge (duration.scale -1 year) time-left))
@@ -108,36 +108,36 @@
(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])
(if (duration/>= duration.empty time)
(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))
+ (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))
+ (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)
(-> Int Text)
- (if (i/< 10 value)
+ (if (i/< +10 value)
(text/compose "0" (int/encode value))
(int/encode value)))
@@ -149,48 +149,48 @@
(def: (encode-millis millis)
(-> Int Text)
- (cond (i/= 0 millis) ""
- (i/< 10 millis) ($_ text/compose ".00" (int/encode millis))
- (i/< 100 millis) ($_ text/compose ".0" (int/encode millis))
- ## (i/< 1_000 millis)
+ (cond (i/= +0 millis) ""
+ (i/< +10 millis) ($_ text/compose ".00" (int/encode millis))
+ (i/< +100 millis) ($_ text/compose ".0" (int/encode millis))
+ ## (i/< +1_000 millis)
($_ text/compose "." (int/encode millis))))
(def: seconds-per-day Int (duration.query duration.second duration.day))
-(def: days-up-to-epoch Int 719468)
+(def: days-up-to-epoch Int +719468)
(def: (extract-date instant)
(-> Instant [[Int Int Int] duration.Duration])
(let [offset (relative instant)
seconds (duration.query duration.second offset)
z (|> seconds (i// seconds-per-day) (i/+ days-up-to-epoch))
- era (i// 146097
- (if (i/>= 0 z)
+ era (i// +146097
+ (if (i/>= +0 z)
z
- (i/- 146096 z)))
- days-of-era (|> z (i/- (i/* 146097 era)))
+ (i/- +146096 z)))
+ days-of-era (|> z (i/- (i/* +146097 era)))
years-of-era (|> days-of-era
- (i/- (i// 1460 days-of-era))
- (i/+ (i// 36524 days-of-era))
- (i/- (i// 146096 days-of-era))
- (i// 365))
- year (|> years-of-era (i/+ (i/* 400 era)))
+ (i/- (i// +1460 days-of-era))
+ (i/+ (i// +36524 days-of-era))
+ (i/- (i// +146096 days-of-era))
+ (i// +365))
+ year (|> years-of-era (i/+ (i/* +400 era)))
days-of-year (|> days-of-era
- (i/- (|> (i/* 365 years-of-era)
- (i/+ (i// 4 years-of-era))
- (i/- (i// 100 years-of-era)))))
+ (i/- (|> (i/* +365 years-of-era)
+ (i/+ (i// +4 years-of-era))
+ (i/- (i// +100 years-of-era)))))
day-time (duration.frame duration.day offset)
days-of-year (if (duration/>= duration.empty day-time)
days-of-year
(dec days-of-year))
- mp (|> days-of-year (i/* 5) (i/+ 2) (i// 153))
+ mp (|> days-of-year (i/* +5) (i/+ +2) (i// +153))
day (|> days-of-year
- (i/- (|> mp (i/* 153) (i/+ 2) (i// 5)))
- (i/+ 1))
+ (i/- (|> mp (i/* +153) (i/+ +2) (i// +5)))
+ (i/+ +1))
month (|> mp
- (i/+ (if (i/< 10 mp)
- 3
+ (i/+ (if (i/< +10 mp)
+ +3
-9)))
- year (if (i/<= 2 month)
+ year (if (i/<= +2 month)
(inc year)
year)]
[[year month day]
@@ -218,29 +218,29 @@
(def: lex-year
(l.Lexer Int)
(do p.Monad<Parser>
- [sign? (p.maybe (l.this "-"))
+ [sign (p.or (l.this "-") (l.this "+"))
raw-year (p.codec number.Codec<Text,Int> (l.many l.decimal))
- #let [signum (case sign?
- #.None 1
- (#.Some _) -1)]]
+ #let [signum (case sign
+ (#.Left _) -1
+ (#.Right _) +1)]]
(wrap (i/* signum raw-year))))
(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)))
+ (:: p.Monad<Parser> wrap +0)))
(def: (leap-years year)
(-> Int Int)
- (|> (i// 4 year)
- (i/- (i// 100 year))
- (i/+ (i// 400 year))))
+ (|> (i// +4 year)
+ (i/- (i// +100 year))
+ (i/+ (i// +400 year))))
## Based on: https://stackoverflow.com/a/3309340/6823464
(def: lex-instant
@@ -250,8 +250,8 @@
_ (l.this "-")
utc-month lex-section
_ (p.assert "Invalid month."
- (and (i/>= 1 utc-month)
- (i/<= 12 utc-month)))
+ (and (i/>= +1 utc-month)
+ (i/<= +12 utc-month)))
#let [months (if (leap-year? utc-year)
leap-year-months
normal-months)
@@ -261,34 +261,34 @@
_ (l.this "-")
utc-day lex-section
_ (p.assert "Invalid day."
- (and (i/>= 1 utc-day)
+ (and (i/>= +1 utc-day)
(i/<= (.int month-days) utc-day)))
_ (l.this "T")
utc-hour lex-section
_ (p.assert "Invalid hour."
- (and (i/>= 0 utc-hour)
- (i/<= 23 utc-hour)))
+ (and (i/>= +0 utc-hour)
+ (i/<= +23 utc-hour)))
_ (l.this ":")
utc-minute lex-section
_ (p.assert "Invalid minute."
- (and (i/>= 0 utc-minute)
- (i/<= 59 utc-minute)))
+ (and (i/>= +0 utc-minute)
+ (i/<= +59 utc-minute)))
_ (l.this ":")
utc-second lex-section
_ (p.assert "Invalid second."
- (and (i/>= 0 utc-second)
- (i/<= 59 utc-second)))
+ (and (i/>= +0 utc-second)
+ (i/<= +59 utc-second)))
utc-millis lex-millis
_ (l.this "Z")
#let [years-since-epoch (i/- epoch-year utc-year)
previous-leap-days (i/- (leap-years epoch-year)
(leap-years (dec utc-year)))
- year-days-so-far (|> (i/* 365 years-since-epoch)
+ year-days-so-far (|> (i/* +365 years-since-epoch)
(i/+ previous-leap-days))
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)))]]
@@ -320,18 +320,18 @@
(let [[[year month day] _] (extract-date instant)]
{#date.year year
#date.month (case (dec month)
- 0 #date.January
- 1 #date.February
- 2 #date.March
- 3 #date.April
- 4 #date.May
- 5 #date.June
- 6 #date.July
- 7 #date.August
- 8 #date.September
- 9 #date.October
- 10 #date.November
- 11 #date.December
+ +0 #date.January
+ +1 #date.February
+ +2 #date.March
+ +3 #date.April
+ +4 #date.May
+ +5 #date.June
+ +6 #date.July
+ +7 #date.August
+ +8 #date.September
+ +9 #date.October
+ +10 #date.November
+ +11 #date.December
_ (undefined))
#date.day (.nat day)}))
@@ -350,16 +350,16 @@
(dec days)
days)
## 1970/01/01 was a Thursday
- y1970m0d0 4]
+ y1970m0d0 +4]
(case (|> y1970m0d0
- (i/+ days) (i/% 7)
+ (i/+ days) (i/% +7)
## This is done to turn negative days into positive days.
- (i/+ 7) (i/% 7))
- 0 #date.Sunday
- 1 #date.Monday
- 2 #date.Tuesday
- 3 #date.Wednesday
- 4 #date.Thursday
- 5 #date.Friday
- 6 #date.Saturday
+ (i/+ +7) (i/% +7))
+ +0 #date.Sunday
+ +1 #date.Monday
+ +2 #date.Tuesday
+ +3 #date.Wednesday
+ +4 #date.Thursday
+ +5 #date.Friday
+ +6 #date.Saturday
_ (undefined))))
diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux
index 376d40d67..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 7e77b0bb6..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 91de1058e..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 68d0410dd..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/type/unit.lux b/stdlib/source/lux/type/unit.lux
index df714a996..96584a989 100644
--- a/stdlib/source/lux/type/unit.lux
+++ b/stdlib/source/lux/type/unit.lux
@@ -85,10 +85,10 @@
(s.tuple (do p.Monad<Parser>
[numerator s.int
_ (p.assert (format "Numerator must be positive: " (%i numerator))
- (i/> 0 numerator))
+ (i/> +0 numerator))
denominator s.int
_ (p.assert (format "Denominator must be positive: " (%i denominator))
- (i/> 0 denominator))]
+ (i/> +0 denominator))]
(wrap [(.nat numerator) (.nat denominator)]))))
(syntax: #export (scale:
@@ -150,13 +150,13 @@
(i// (.int denominator))
in)))
-(scale: #export Kilo [1 1_000])
-(scale: #export Mega [1 1_000_000])
-(scale: #export Giga [1 1_000_000_000])
+(scale: #export Kilo [+1 +1_000])
+(scale: #export Mega [+1 +1_000_000])
+(scale: #export Giga [+1 +1_000_000_000])
-(scale: #export Milli [ 1_000 1])
-(scale: #export Micro [ 1_000_000 1])
-(scale: #export Nano [1_000_000_000 1])
+(scale: #export Milli [ +1_000 +1])
+(scale: #export Micro [ +1_000_000 +1])
+(scale: #export Nano [+1_000_000_000 +1])
(unit: #export Gram)
(unit: #export Meter)
diff --git a/stdlib/source/lux/world/binary.lux b/stdlib/source/lux/world/binary.lux
index d89b7ae3a..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 6974af0ba..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 {}