From e6db62dbd6529938dace0e1cf5743f4e985efb81 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jul 2018 15:39:06 -0400 Subject: Removed temporary "|" prefix on Nat. --- stdlib/source/lux.lux | 654 ++++++++++----------- stdlib/source/lux/compiler/default/cache.lux | 2 +- stdlib/source/lux/compiler/default/init.lux | 12 +- stdlib/source/lux/compiler/default/name.lux | 2 +- .../source/lux/compiler/default/phase/analysis.lux | 14 +- .../default/phase/analysis/case/coverage.lux | 4 +- .../compiler/default/phase/analysis/inference.lux | 12 +- .../lux/compiler/default/phase/analysis/scope.lux | 6 +- .../compiler/default/phase/analysis/structure.lux | 2 +- .../default/phase/extension/analysis/common.lux | 10 +- .../default/phase/extension/analysis/host.jvm.lux | 50 +- .../lux/compiler/default/phase/synthesis.lux | 4 +- .../default/phase/synthesis/expression.lux | 6 +- .../compiler/default/phase/synthesis/function.lux | 10 +- .../lux/compiler/default/phase/synthesis/loop.lux | 2 +- .../lux/compiler/default/phase/translation.lux | 6 +- .../translation/scheme/extension/common.jvm.lux | 18 +- .../phase/translation/scheme/function.jvm.lux | 4 +- .../phase/translation/scheme/runtime.jvm.lux | 8 +- stdlib/source/lux/compiler/default/reference.lux | 8 +- stdlib/source/lux/compiler/default/repl/type.lux | 2 +- stdlib/source/lux/compiler/default/syntax.lux | 40 +- stdlib/source/lux/compiler/meta/io/archive.lux | 2 +- stdlib/source/lux/concurrency/actor.lux | 4 +- stdlib/source/lux/concurrency/promise.lux | 2 +- stdlib/source/lux/concurrency/semaphore.lux | 18 +- stdlib/source/lux/control/comonad.lux | 4 +- stdlib/source/lux/control/concatenative.lux | 22 +- stdlib/source/lux/control/equivalence.lux | 4 +- stdlib/source/lux/control/exception.lux | 2 +- stdlib/source/lux/control/monad.lux | 6 +- stdlib/source/lux/control/parser.lux | 8 +- stdlib/source/lux/control/pipe.lux | 2 +- stdlib/source/lux/control/writer.lux | 2 +- stdlib/source/lux/data/bit.lux | 4 +- stdlib/source/lux/data/collection/array.lux | 30 +- stdlib/source/lux/data/collection/bits.lux | 28 +- stdlib/source/lux/data/collection/dictionary.lux | 56 +- .../lux/data/collection/dictionary/ordered.lux | 2 +- stdlib/source/lux/data/collection/list.lux | 74 +-- .../source/lux/data/collection/queue/priority.lux | 4 +- stdlib/source/lux/data/collection/row.lux | 56 +- stdlib/source/lux/data/collection/sequence.lux | 4 +- stdlib/source/lux/data/collection/set.lux | 4 +- stdlib/source/lux/data/collection/set/multi.lux | 22 +- .../lux/data/collection/tree/rose/zipper.lux | 8 +- stdlib/source/lux/data/color.lux | 20 +- stdlib/source/lux/data/format/binary.lux | 36 +- stdlib/source/lux/data/number.lux | 341 ++++++----- stdlib/source/lux/data/number/complex.lux | 4 +- stdlib/source/lux/data/number/i64.lux | 22 +- stdlib/source/lux/data/number/ratio.lux | 16 +- stdlib/source/lux/data/sum.lux | 20 +- stdlib/source/lux/data/text.lux | 18 +- stdlib/source/lux/data/text/buffer.lux | 4 +- stdlib/source/lux/data/text/lexer.lux | 4 +- stdlib/source/lux/data/text/regex.lux | 14 +- stdlib/source/lux/data/text/unicode.lux | 246 ++++---- stdlib/source/lux/host.jvm.lux | 6 +- stdlib/source/lux/io.lux | 2 +- stdlib/source/lux/macro/code.lux | 2 +- stdlib/source/lux/macro/poly.lux | 36 +- stdlib/source/lux/macro/poly/equivalence.lux | 2 +- stdlib/source/lux/macro/poly/functor.lux | 8 +- stdlib/source/lux/macro/poly/json.lux | 10 +- stdlib/source/lux/math.lux | 8 +- stdlib/source/lux/math/random.lux | 34 +- stdlib/source/lux/test.lux | 24 +- stdlib/source/lux/time/date.lux | 50 +- stdlib/source/lux/time/instant.lux | 20 +- stdlib/source/lux/type.lux | 6 +- stdlib/source/lux/type/check.lux | 6 +- stdlib/source/lux/type/implicit.lux | 10 +- stdlib/source/lux/type/resource.lux | 2 +- stdlib/source/lux/world/binary.lux | 70 +-- stdlib/source/lux/world/net/udp.jvm.lux | 4 +- 76 files changed, 1140 insertions(+), 1149 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index dd5a42064..109a590e3 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1,194 +1,194 @@ ("lux def" dummy-cursor - ("lux check" (|2 (|0 "#Text" (|0)) - (|2 (|0 "#I64" (|1 (|0 "#Nat" (|0)) (|0))) - (|0 "#I64" (|1 (|0 "#Nat" (|0)) (|0))))) - ["" |0 |0]) - [["" |0 |0] - (|10 (|1 [[["" |0 |0] (|7 ["lux" "export?"])] - [["" |0 |0] (|0 #1)]] - (|0)))]) + ("lux check" (2 (0 "#Text" (0)) + (2 (0 "#I64" (1 (0 "#Nat" (0)) (0))) + (0 "#I64" (1 (0 "#Nat" (0)) (0))))) + ["" 0 0]) + [["" 0 0] + (10 (1 [[["" 0 0] (7 ["lux" "export?"])] + [["" 0 0] (0 #1)]] + (0)))]) ## (type: Any ## (Ex [a] a)) ("lux def" Any - (|10 ["lux" "Any"] - (|8 (|0) (|4 |1))) + (10 ["lux" "Any"] + (8 (0) (4 1))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things whose type does not matter. + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things whose type does not matter. It can be used to write functions or data-structures that can take, or return, anything.")]] - (|0)))))]) + (0)))))]) ## (type: Nothing ## (All [a] a)) ("lux def" Nothing - (|10 ["lux" "Nothing"] - (|7 (|0) (|4 |1))) + (10 ["lux" "Nothing"] + (7 (0) (4 1))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things whose type is unknown or undefined. + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things whose type is unknown or undefined. Useful for expressions that cause errors or other \"extraordinary\" conditions.")]] - (|0)))))]) + (0)))))]) ## (type: (List a) ## #Nil ## (#Cons a (List a))) ("lux def" List - (|10 ["lux" "List"] - (|7 (|0) - (|1 ## "lux.Nil" - Any - ## "lux.Cons" - (|2 (|4 |1) - (|9 (|4 |1) (|4 |0)))))) + (10 ["lux" "List"] + (7 (0) + (1 ## "lux.Nil" + Any + ## "lux.Cons" + (2 (4 1) + (9 (4 1) (4 0)))))) [dummy-cursor - (|10 (|1 [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (|1 [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (|1 [dummy-cursor (|5 "Nil")] (|1 [dummy-cursor (|5 "Cons")] (|0))))]] - (|1 [[dummy-cursor (|7 ["lux" "type-args"])] - [dummy-cursor (|9 (|1 [dummy-cursor (|5 "a")] (|0)))]] - (|1 [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A potentially empty list of values.")]] - (|0)))))))]) + (10 (1 [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (1 [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (1 [dummy-cursor (5 "Nil")] (1 [dummy-cursor (5 "Cons")] (0))))]] + (1 [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]] + (1 [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially empty list of values.")]] + (0)))))))]) ("lux def" Bit - (|10 ["lux" "Bit"] - (|0 "#Bit" #Nil)) + (10 ["lux" "Bit"] + (0 "#Bit" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill boolean values (as bits).")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]] + #Nil))))]) ("lux def" I64 - (|10 ["lux" "I64"] - (|7 (|0) - (|0 "#I64" (#Cons (|4 |1) #Nil)))) + (10 ["lux" "I64"] + (7 (0) + (0 "#I64" (#Cons (4 1) #Nil)))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "64-bit integers without any semantics.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "64-bit integers without any semantics.")]] + #Nil))))]) ("lux def" Nat - (|10 ["lux" "Nat"] - (|0 "#I64" (#Cons (|0 "#Nat" #Nil) #Nil))) + (10 ["lux" "Nat"] + (0 "#I64" (#Cons (0 "#Nat" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Natural numbers (unsigned integers). + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Natural numbers (unsigned integers). - They start at zero (|0) and extend in the positive direction.")]] - #Nil))))]) + They start at zero (0) and extend in the positive direction.")]] + #Nil))))]) ("lux def" Int - (|10 ["lux" "Int"] - (|0 "#I64" (#Cons (|0 "#Int" #Nil) #Nil))) + (10 ["lux" "Int"] + (0 "#I64" (#Cons (0 "#Int" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill integer numbers.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]] + #Nil))))]) ("lux def" Rev - (|10 ["lux" "Rev"] - (|0 "#I64" (#Cons (|0 "#Rev" #Nil) #Nil))) + (10 ["lux" "Rev"] + (0 "#I64" (#Cons (0 "#Rev" #Nil) #Nil))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Fractional numbers that live in the interval [0,1). + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Fractional numbers that live in the interval [0,1). Useful for probability, and other domains that work within that interval.")]] - #Nil))))]) + #Nil))))]) ("lux def" Frac - (|10 ["lux" "Frac"] - (|0 "#Frac" #Nil)) + (10 ["lux" "Frac"] + (0 "#Frac" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]] + #Nil))))]) ("lux def" Text - (|10 ["lux" "Text"] - (|0 "#Text" #Nil)) + (10 ["lux" "Text"] + (0 "#Text" #Nil)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Your standard, run-of-the-mill string values.")]] - #Nil))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]] + #Nil))))]) ("lux def" Name - (|10 ["lux" "Name"] - (|2 Text Text)) + (10 ["lux" "Name"] + (2 Text Text)) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A name. + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]] - #Nil))))]) + #Nil))))]) ## (type: (Maybe a) ## #None ## (#Some a)) ("lux def" Maybe - (|10 ["lux" "Maybe"] - (|7 #Nil - (|1 ## "lux.None" - Any - ## "lux.Some" - (|4 |1)))) + (10 ["lux" "Maybe"] + (7 #Nil + (1 ## "lux.None" + Any + ## "lux.Some" + (4 1)))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "None")] (#Cons [dummy-cursor (|5 "Some")] #Nil)))]] - (#Cons [[dummy-cursor (|7 ["lux" "type-args"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "a")] #Nil))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "A potentially missing value.")]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "None")] (#Cons [dummy-cursor (5 "Some")] #Nil)))]] + (#Cons [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "A potentially missing value.")]] + #Nil))))))]) ## (type: #rec Type ## (#Primitive Text (List Type)) @@ -204,60 +204,60 @@ ## (#Named Name Type) ## ) ("lux def" Type - (|10 ["lux" "Type"] - ({Type - ({Type-List - ({Type-Pair - (|9 Nothing - (|7 #Nil - (|1 ## "lux.Primitive" - (|2 Text Type-List) - (|1 ## "lux.Sum" - Type-Pair - (|1 ## "lux.Product" - Type-Pair - (|1 ## "lux.Function" - Type-Pair - (|1 ## "lux.Parameter" - Nat - (|1 ## "lux.Var" - Nat - (|1 ## "lux.Ex" - Nat - (|1 ## "lux.UnivQ" - (|2 Type-List Type) - (|1 ## "lux.ExQ" - (|2 Type-List Type) - (|1 ## "lux.Apply" - Type-Pair - ## "lux.Named" - (|2 Name Type)))))))))))))} - ("lux check type" (|2 Type Type)))} - ("lux check type" (|9 Type List)))} - ("lux check type" (|9 (|4 |1) (|4 |0))))) + (10 ["lux" "Type"] + ({Type + ({Type-List + ({Type-Pair + (9 Nothing + (7 #Nil + (1 ## "lux.Primitive" + (2 Text Type-List) + (1 ## "lux.Sum" + Type-Pair + (1 ## "lux.Product" + Type-Pair + (1 ## "lux.Function" + Type-Pair + (1 ## "lux.Parameter" + Nat + (1 ## "lux.Var" + Nat + (1 ## "lux.Ex" + Nat + (1 ## "lux.UnivQ" + (2 Type-List Type) + (1 ## "lux.ExQ" + (2 Type-List Type) + (1 ## "lux.Apply" + Type-Pair + ## "lux.Named" + (2 Name Type)))))))))))))} + ("lux check type" (2 Type Type)))} + ("lux check type" (9 Type List)))} + ("lux check type" (9 (4 1) (4 0))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "Primitive")] - (#Cons [dummy-cursor (|5 "Sum")] - (#Cons [dummy-cursor (|5 "Product")] - (#Cons [dummy-cursor (|5 "Function")] - (#Cons [dummy-cursor (|5 "Parameter")] - (#Cons [dummy-cursor (|5 "Var")] - (#Cons [dummy-cursor (|5 "Ex")] - (#Cons [dummy-cursor (|5 "UnivQ")] - (#Cons [dummy-cursor (|5 "ExQ")] - (#Cons [dummy-cursor (|5 "Apply")] - (#Cons [dummy-cursor (|5 "Named")] - #Nil))))))))))))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "This type represents the data-structures that are used to specify types themselves.")]] - (#Cons [[dummy-cursor (|7 ["lux" "type-rec?"])] - [dummy-cursor (|0 #1)]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "Primitive")] + (#Cons [dummy-cursor (5 "Sum")] + (#Cons [dummy-cursor (5 "Product")] + (#Cons [dummy-cursor (5 "Function")] + (#Cons [dummy-cursor (5 "Parameter")] + (#Cons [dummy-cursor (5 "Var")] + (#Cons [dummy-cursor (5 "Ex")] + (#Cons [dummy-cursor (5 "UnivQ")] + (#Cons [dummy-cursor (5 "ExQ")] + (#Cons [dummy-cursor (5 "Apply")] + (#Cons [dummy-cursor (5 "Named")] + #Nil))))))))))))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "This type represents the data-structures that are used to specify types themselves.")]] + (#Cons [[dummy-cursor (7 ["lux" "type-rec?"])] + [dummy-cursor (0 #1)]] + #Nil))))))]) ## (type: Cursor ## {#module Text @@ -267,18 +267,18 @@ (#Named ["lux" "Cursor"] (#Product Text (#Product Nat Nat))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "module")] - (#Cons [dummy-cursor (|5 "line")] - (#Cons [dummy-cursor (|5 "column")] - #Nil))))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]] - (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil)))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "module")] + (#Cons [dummy-cursor (5 "line")] + (#Cons [dummy-cursor (5 "column")] + #Nil))))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]] + (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil)))))]) ## (type: (Ann m v) ## {#meta m @@ -287,22 +287,22 @@ (#Named ["lux" "Ann"] (#UnivQ #Nil (#UnivQ #Nil - (#Product (#Parameter |3) - (#Parameter |1))))) + (#Product (#Parameter 3) + (#Parameter 1))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "meta")] - (#Cons [dummy-cursor (|5 "datum")] - #Nil)))]] - (#Cons [[dummy-cursor (|7 ["lux" "doc"])] - [dummy-cursor (|5 "The type of things that can be annotated with meta-data of arbitrary types.")]] - (#Cons [[dummy-cursor (|7 ["lux" "type-args"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "m")] (#Cons [dummy-cursor (|5 "v")] #Nil)))]] - (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil))))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "meta")] + (#Cons [dummy-cursor (5 "datum")] + #Nil)))]] + (#Cons [[dummy-cursor (7 ["lux" "doc"])] + [dummy-cursor (5 "The type of things that can be annotated with meta-data of arbitrary types.")]] + (#Cons [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "m")] (#Cons [dummy-cursor (5 "v")] #Nil)))]] + (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil))))))]) ## (type: (Code' w) ## (#Bit Bit) @@ -346,30 +346,30 @@ )))))))))) )} ("lux check type" (#Apply Code List)))} - ("lux check type" (#Apply (#Apply (#Parameter |1) - (#Parameter |0)) - (#Parameter |1))))) + ("lux check type" (#Apply (#Apply (#Parameter 1) + (#Parameter 0)) + (#Parameter 1))))) [dummy-cursor - (|10 (#Cons [[dummy-cursor (|7 ["lux" "tags"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "Bit")] - (#Cons [dummy-cursor (|5 "Nat")] - (#Cons [dummy-cursor (|5 "Int")] - (#Cons [dummy-cursor (|5 "Rev")] - (#Cons [dummy-cursor (|5 "Frac")] - (#Cons [dummy-cursor (|5 "Text")] - (#Cons [dummy-cursor (|5 "Identifier")] - (#Cons [dummy-cursor (|5 "Tag")] - (#Cons [dummy-cursor (|5 "Form")] - (#Cons [dummy-cursor (|5 "Tuple")] - (#Cons [dummy-cursor (|5 "Record")] - #Nil))))))))))))]] - (#Cons [[dummy-cursor (|7 ["lux" "type-args"])] - [dummy-cursor (|9 (#Cons [dummy-cursor (|5 "w")] #Nil))]] - (#Cons [[dummy-cursor (|7 ["lux" "type?"])] - [dummy-cursor (|0 #1)]] - (#Cons [[dummy-cursor (|7 ["lux" "export?"])] - [dummy-cursor (|0 #1)]] - #Nil)))))]) + (10 (#Cons [[dummy-cursor (7 ["lux" "tags"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "Bit")] + (#Cons [dummy-cursor (5 "Nat")] + (#Cons [dummy-cursor (5 "Int")] + (#Cons [dummy-cursor (5 "Rev")] + (#Cons [dummy-cursor (5 "Frac")] + (#Cons [dummy-cursor (5 "Text")] + (#Cons [dummy-cursor (5 "Identifier")] + (#Cons [dummy-cursor (5 "Tag")] + (#Cons [dummy-cursor (5 "Form")] + (#Cons [dummy-cursor (5 "Tuple")] + (#Cons [dummy-cursor (5 "Record")] + #Nil))))))))))))]] + (#Cons [[dummy-cursor (7 ["lux" "type-args"])] + [dummy-cursor (9 (#Cons [dummy-cursor (5 "w")] #Nil))]] + (#Cons [[dummy-cursor (7 ["lux" "type?"])] + [dummy-cursor (0 #1)]] + (#Cons [[dummy-cursor (7 ["lux" "export?"])] + [dummy-cursor (0 #1)]] + #Nil)))))]) ## (type: Code ## (Ann Cursor (Code' (Ann Cursor)))) @@ -490,8 +490,8 @@ (#Product ## "lux.counter" Nat ## "lux.mappings" - (#Apply (#Product (#Parameter |3) - (#Parameter |1)) + (#Apply (#Product (#Parameter 3) + (#Parameter 1)) List))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "counter") (#Cons (text$ "mappings") #Nil)))] @@ -543,9 +543,9 @@ (#UnivQ #Nil (#UnivQ #Nil (#Sum ## "lux.Left" - (#Parameter |3) + (#Parameter 3) ## "lux.Right" - (#Parameter |1))))) + (#Parameter 1))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "Left") (#Cons (text$ "Right") #Nil)))] (#Cons [(tag$ ["lux" "type-args"]) @@ -760,7 +760,7 @@ (#Named ["lux" "Meta"] (#UnivQ #Nil (#Function Lux - (#Apply (#Product Lux (#Parameter |1)) + (#Apply (#Product Lux (#Parameter 1)) (#Apply Text Either))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Computations that can have access to the state of the compiler. @@ -782,10 +782,10 @@ ## Base functions & macros ("lux def" return ("lux check" (#UnivQ #Nil - (#Function (#Parameter |1) + (#Function (#Parameter 1) (#Function Lux (#Apply (#Product Lux - (#Parameter |1)) + (#Parameter 1)) (#Apply Text Either))))) ([_ val] ([_ state] @@ -797,7 +797,7 @@ (#Function Text (#Function Lux (#Apply (#Product Lux - (#Parameter |1)) + (#Parameter 1)) (#Apply Text Either))))) ([_ msg] ([_ state] @@ -861,7 +861,7 @@ ("lux def" cursor-code ("lux check" Code - (tuple$ (#Cons (text$ "") (#Cons (nat$ |0) (#Cons (nat$ |0) #Nil))))) + (tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil))))) (record$ #Nil)) ("lux def" meta-code @@ -1052,9 +1052,9 @@ #Nil (#UnivQ #Nil (#UnivQ #Nil - (#Function (#Function (#Parameter |3) (#Parameter |1)) - (#Function ($' List (#Parameter |3)) - ($' List (#Parameter |1)))))) + (#Function (#Function (#Parameter 3) (#Parameter 1)) + (#Function ($' List (#Parameter 3)) + ($' List (#Parameter 1)))))) ({#Nil #Nil @@ -1164,7 +1164,7 @@ pairs)) [_ (#Form (#Cons [_ (#Tag "lux" "Parameter")] (#Cons [_ (#Nat idx)] #Nil)))] - (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ |2 idx)) #Nil))) + (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ 2 idx)) #Nil))) [_ (#Form members)] (form$ (list/map update-parameters members)) @@ -1198,12 +1198,12 @@ (def:'' (list/fold f init xs) #Nil ## (All [a b] (-> (-> b a a) a (List b) a)) - (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter |1) - (#Function (#Parameter |3) - (#Parameter |3))) - (#Function (#Parameter |3) - (#Function ($' List (#Parameter |1)) - (#Parameter |3)))))) + (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter 1) + (#Function (#Parameter 3) + (#Parameter 3))) + (#Function (#Parameter 3) + (#Function ($' List (#Parameter 1)) + (#Parameter 3)))))) ({#Nil init @@ -1214,8 +1214,8 @@ (def:'' (list/size list) #Nil (#UnivQ #Nil - (#Function ($' List (#Parameter |1)) Nat)) - (list/fold (function'' [_ acc] (n/+ |1 acc)) |0 list)) + (#Function ($' List (#Parameter 1)) Nat)) + (list/fold (function'' [_ acc] (n/+ 1 acc)) 0 list)) (macro:' #export (All tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1241,7 +1241,7 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-parameter |1)] #Nil) + (#Cons (replace-syntax (#Cons [name' (make-parameter 1)] #Nil) (update-parameters body')) #Nil)))))) body names) @@ -1252,7 +1252,7 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* |2 (n/- |1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 (n/- 1 (list/size names))))] #Nil) body')} [(text/= "" self-name) names]) @@ -1288,7 +1288,7 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-parameter |1)] #Nil) + (#Cons (replace-syntax (#Cons [name' (make-parameter 1)] #Nil) (update-parameters body')) #Nil)))))) body names) @@ -1299,7 +1299,7 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* |2 (n/- |1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 (n/- 1 (list/size names))))] #Nil) body')} [(text/= "" self-name) names]) @@ -1518,7 +1518,7 @@ (def:''' (wrap-meta content) #Nil (-> Code Code) - (tuple$ (list (tuple$ (list (text$ "") (nat$ |0) (nat$ |0))) + (tuple$ (list (tuple$ (list (text$ "") (nat$ 0) (nat$ 0))) content))) (def:''' (untemplate-list tokens) @@ -2199,14 +2199,14 @@ (def:''' (high-bits value) (list) (-> ($' I64 Any) I64) - ("lux i64 logical-right-shift" |32 value)) + ("lux i64 logical-right-shift" 32 value)) (def:''' low-mask (list) I64 - (|> |1 - ("lux i64 left-shift" |32) - ("lux i64 -" |1))) + (|> 1 + ("lux i64 left-shift" 32) + ("lux i64 -" 1))) (def:''' (low-bits value) (list) @@ -2366,12 +2366,12 @@ (-> Nat Nat Nat) (if ("lux int <" ("lux coerce" Int param) +0) (if (n/< param subject) - |0 - |1) + 0 + 1) (let' [quotient ("lux i64 left-shift" - |1 + 1 ("lux int /" - ("lux i64 logical-right-shift" |1 subject) + ("lux i64 logical-right-shift" 1 subject) ("lux coerce" Int param))) flat ("lux int *" ("lux coerce" Int quotient) @@ -2379,7 +2379,7 @@ remainder ("lux i64 -" flat subject)] (if (n/< param remainder) quotient - ("lux i64 +" |1 quotient))))) + ("lux i64 +" 1 quotient))))) (def:''' #export (n//% param subject) (list [(tag$ ["lux" "doc"]) @@ -2442,7 +2442,7 @@ paramL (low-bits param) bottom (|> subjectL ("lux int *" paramL) - ("lux i64 logical-right-shift" |32)) + ("lux i64 logical-right-shift" 32)) middle ("lux i64 +" ("lux int *" subjectH paramL) ("lux int *" subjectL paramH)) @@ -2452,17 +2452,17 @@ high-bits ("lux i64 +" top)))) -(def:''' least-significant-bit-mask (list) Nat |1) +(def:''' least-significant-bit-mask (list) Nat 1) (def:''' (without-trailing-zeroes count remaining) (list) (-> Nat Nat (#Product Nat Nat)) (if (|> remaining ("lux i64 and" least-significant-bit-mask) - ("lux i64 =" |0)) + ("lux i64 =" 0)) (without-trailing-zeroes - ("lux i64 +" |1 count) - ("lux i64 logical-right-shift" |1 remaining)) + ("lux i64 +" 1 count) + ("lux i64 logical-right-shift" 1 remaining)) [count remaining])) (def:''' #export (r// param subject) @@ -2471,13 +2471,13 @@ (-> Rev Rev Rev) (if ("lux i64 =" +0 param) ("lux io error" "Cannot divide Rev by zero!") - (let' [[trailing-zeroes remaining] (without-trailing-zeroes |0 ("lux coerce" Nat param)) + (let' [[trailing-zeroes remaining] (without-trailing-zeroes 0 ("lux coerce" Nat param)) [trailing-zeroes denominator] ("lux check" (#Product Nat Nat) (if ("lux i64 =" +0 trailing-zeroes) - [|1 ("lux i64 logical-right-shift" |1 remaining)] + [1 ("lux i64 logical-right-shift" 1 remaining)] [trailing-zeroes remaining])) - shift ("lux i64 -" trailing-zeroes |64) - numerator ("lux i64 left-shift" shift |1)] + shift ("lux i64 -" trailing-zeroes 64) + numerator ("lux i64 left-shift" shift 1)] ("lux coerce" Rev ("lux int *" ("lux coerce" Int subject) @@ -2507,10 +2507,10 @@ (text$ "Rev(olution) reciprocal of a Nat(ural).")]) (-> Nat Rev) ("lux coerce" Rev - (let' [[trailing-zeroes remaining] (without-trailing-zeroes |0 numerator)] + (let' [[trailing-zeroes remaining] (without-trailing-zeroes 0 numerator)] (n// remaining - ({|0 ("lux coerce" Nat -1) - _ ("lux i64 left-shift" (n/- trailing-zeroes |64) |1)} + ({0 ("lux coerce" Nat -1) + _ ("lux i64 left-shift" (n/- trailing-zeroes 64) 1)} trailing-zeroes))))) (do-template [ ] @@ -2543,26 +2543,26 @@ (def:''' (digit-to-text digit) #Nil (-> Nat Text) - ({|0 "0" - |1 "1" |2 "2" |3 "3" - |4 "4" |5 "5" |6 "6" - |7 "7" |8 "8" |9 "9" + ({0 "0" + 1 "1" 2 "2" 3 "3" + 4 "4" 5 "5" 6 "6" + 7 "7" 8 "8" 9 "9" _ ("lux io error" "undefined")} digit)) (def:''' (nat/encode value) #Nil (-> Nat Text) - ({|0 - "|0" + ({0 + "0" _ (let' [loop ("lux check" (-> Nat Text Text) (function' recur [input output] - (if (n/= |0 input) + (if (n/= 0 input) (text/compose "|" output) - (recur (n// |10 input) - (text/compose (|> input (n/% |10) digit-to-text) + (recur (n// 10 input) + (text/compose (|> input (n/% 10) digit-to-text) output)))))] (loop value ""))} value)) @@ -2600,7 +2600,7 @@ (def:''' (multiple? div n) #Nil (-> Nat Nat Bit) - (|> n (n/% div) (n/= |0))) + (|> n (n/% div) (n/= 0))) (def:''' #export (not x) (list [(tag$ ["lux" "doc"]) @@ -2935,7 +2935,7 @@ #scope-type-vars scope-type-vars} (#Right {#info info #source source #current-module _ #modules modules #scopes scopes #type-context types #host host - #seed (n/+ |1 seed) #expected expected + #seed (n/+ 1 seed) #expected expected #cursor cursor #extensions extensions #scope-type-vars scope-type-vars} (identifier$ ["" ($_ text/compose "__gensym__" prefix (nat/encode seed))]))} @@ -2948,7 +2948,7 @@ (Rec Self [Int (List Self)])")]) ({(#Cons [_ (#Identifier "" name)] (#Cons body #Nil)) - (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter |1)) (~ (make-parameter |0))))]) + (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter 1)) (~ (make-parameter 0))))]) (update-parameters body))] (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) @@ -3209,7 +3209,7 @@ (op x y))")]) (case tokens (^ (list [_ (#Tuple bindings)] body)) - (if (multiple? |2 (list/size bindings)) + (if (multiple? 2 (list/size bindings)) (|> bindings as-pairs list/reverse (list/fold (: (-> [Code Code] Code Code) (function' [lr body'] @@ -3573,7 +3573,7 @@ (def: (index-of part text) (-> Text Text (Maybe Nat)) - ("lux text index" text part |0)) + ("lux text index" text part 0)) (def: (last-index-of' part part-size since text) (-> Text Nat Nat Text (Maybe Nat)) @@ -3586,7 +3586,7 @@ (def: (last-index-of part text) (-> Text Text (Maybe Nat)) - (case ("lux text index" text part |0) + (case ("lux text index" text part 0) (#Some since) (last-index-of' part ("lux text size" part) since text) @@ -3635,10 +3635,10 @@ (#Some idx) (list& (default (error! "UNDEFINED") - (clip2 |0 idx input)) + (clip2 0 idx input)) (text/split splitter (default (error! "UNDEFINED") - (clip1 (n/+ |1 idx) input)))))) + (clip1 (n/+ 1 idx) input)))))) (def: (nth idx xs) (All [a] @@ -3648,9 +3648,9 @@ #None (#Cons x xs') - (if (n/= |0 idx) + (if (n/= 0 idx) (#Some x) - (nth (n/- |1 idx) xs') + (nth (n/- 1 idx) xs') ))) (def: (beta-reduce env type) @@ -4132,7 +4132,7 @@ (def: (split at x) (-> Nat Text (Maybe [Text Text])) - (case [(..clip2 |0 at x) (..clip1 at x)] + (case [(..clip2 0 at x) (..clip1 at x)] [(#.Some pre) (#.Some post)] (#.Some [pre post]) @@ -4170,38 +4170,38 @@ (#Some found) (if (n/= ups found) - (count-ups (n/+ |1 ups) input) + (count-ups (n/+ 1 ups) input) ups))) (def: (list/drop amount a+) (All [a] (-> Nat (List a) (List a))) (case [amount a+] - (^or [|0 _] [_ #Nil]) + (^or [0 _] [_ #Nil]) a+ [_ (#Cons _ a+')] - (list/drop (n/- |1 amount) a+'))) + (list/drop (n/- 1 amount) a+'))) (def: (clean-module nested? relative-root module) (-> Bit Text Text (Meta Text)) - (case (count-ups |0 module) - |0 + (case (count-ups 0 module) + 0 (return (if nested? ($_ "lux text concat" relative-root "/" module) module)) ups (let [parts (text/split "/" relative-root)] - (if (n/< (list/size parts) (n/- |1 ups)) + (if (n/< (list/size parts) (n/- 1 ups)) (let [prefix (|> parts list/reverse - (list/drop (n/- |1 ups)) + (list/drop (n/- 1 ups)) list/reverse (interpose "/") text/join) clean (|> module (clip1 ups) (default (error! "UNDEFINED"))) output (case ("lux text size" clean) - |0 prefix + 0 prefix _ ($_ text/compose prefix "/" clean))] (return output)) (fail ($_ text/compose @@ -4545,7 +4545,7 @@ (n/odd? num) \"odd\" ## else-branch \"???\")"} - (if (n/= |0 (n/% |2 (list/size tokens))) + (if (n/= 0 (n/% 2 (list/size tokens))) (fail "cond requires an uneven number of arguments.") (case (list/reverse tokens) (^ (list& else branches')) @@ -4563,14 +4563,14 @@ (All [a] (-> Nat (List a) (List [Nat a]))) (case xs (#Cons x xs') - (#Cons [idx x] (enumerate' (n/+ |1 idx) xs')) + (#Cons [idx x] (enumerate' (n/+ 1 idx) xs')) #Nil #Nil)) (def: (enumerate xs) (All [a] (-> (List a) (List [Nat a]))) - (enumerate' |0 xs)) + (enumerate' 0 xs)) (macro: #export (get@ tokens) {#.doc "## Accesses the value of a record at a given tag. @@ -5176,7 +5176,7 @@ [(def: #export {#.doc } (All [s] (-> (I64 s) (I64 s))) - (|>> ( |1)))] + (|>> ( 1)))] [inc "lux i64 +" "Increment function."] [dec "lux i64 -" "Decrement function."] @@ -5715,7 +5715,7 @@ (-> Bit) (not ( n)))] - [Nat n/even? n/odd? n/% n/= |0 |2] + [Nat n/even? n/odd? n/% n/= 0 2] [Int i/even? i/odd? i/% i/= +0 +2]) (def: (get-scope-type-vars state) @@ -5735,17 +5735,17 @@ #None (#Cons x xs') - (if (n/= |0 idx) + (if (n/= 0 idx) (#Some x) (list-at (dec idx) xs')))) (macro: #export ($ tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." - "In the example below, |0 corresponds to the 'a' variable." + "In the example below, 0 corresponds to the 'a' variable." (def: #export (from-list list) (All [a] (-> (List a) (Row a))) (list/fold add - (: (Row ($ |0)) + (: (Row ($ 0)) empty) list)))} (case tokens @@ -5777,7 +5777,7 @@ {#.doc (doc "Allows you to simultaneously bind and de-structure a value." (def: (hash (^@ set [Hash _])) (list/fold (function (_ elem acc) (n/+ (:: Hash hash elem) acc)) - |0 + 0 (to-list set))))} (case tokens (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches)) @@ -5792,7 +5792,7 @@ (macro: #export (^|> tokens) {#.doc (doc "Pipes the value being pattern-matched against prior to binding it to a variable." (case input - (^|> value [inc (n/% |10) (n/max |1)]) + (^|> value [inc (n/% 10) (n/max 1)]) (foo value)))} (case tokens (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] [_ (#Tuple steps)]))] body branches)) @@ -5947,8 +5947,8 @@ (macro: #export (char tokens compiler) (case tokens (^multi (^ (list [_ (#Text input)])) - (n/= |1 ("lux text size" input))) - (|> ("lux text char" input |0) + (n/= 1 ("lux text size" input))) + (|> ("lux text char" input 0) (default (undefined)) nat$ list [compiler] #Right) @@ -6170,7 +6170,7 @@ (def: to-significand (-> (I64 Any) Frac) - (|>> ("lux i64 logical-right-shift" |11) + (|>> ("lux i64 logical-right-shift" 11) int-to-frac)) (def: rev-denominator Frac (to-significand -1)) @@ -6184,7 +6184,7 @@ (f/% +1.0) (f/* rev-denominator) frac-to-int - ("lux i64 left-shift" |11)))) + ("lux i64 left-shift" 11)))) (def: #export rev-to-frac (-> Rev Frac) diff --git a/stdlib/source/lux/compiler/default/cache.lux b/stdlib/source/lux/compiler/default/cache.lux index 1e264ec08..1770b4a82 100644 --- a/stdlib/source/lux/compiler/default/cache.lux +++ b/stdlib/source/lux/compiler/default/cache.lux @@ -18,7 +18,7 @@ (Format Module) ($_ _.and ## #module-hash - (_.ignore |0) + (_.ignore 0) ## #module-aliases (_.list ..alias) ## #definitions diff --git a/stdlib/source/lux/compiler/default/init.lux b/stdlib/source/lux/compiler/default/init.lux index 4972e75c5..af31e03a4 100644 --- a/stdlib/source/lux/compiler/default/init.lux +++ b/stdlib/source/lux/compiler/default/init.lux @@ -6,20 +6,20 @@ (def: #export (cursor file) (-> Text Cursor) - [file |1 |0]) + [file 1 0]) (def: #export (source file code) (-> Text Text Source) - [(cursor file) |0 code]) + [(cursor file) 0 code]) (def: dummy-source Source - [.dummy-cursor |0 ""]) + [.dummy-cursor 0 ""]) (def: #export type-context Type-Context - {#.ex-counter |0 - #.var-counter |0 + {#.ex-counter 0 + #.var-counter 0 #.var-bindings (list)}) (`` (def: #export info @@ -46,7 +46,7 @@ #.scopes (list) #.type-context ..type-context #.expected #.None - #.seed |0 + #.seed 0 #.scope-type-vars (list) #.extensions [] #.host host}) diff --git a/stdlib/source/lux/compiler/default/name.lux b/stdlib/source/lux/compiler/default/name.lux index 34bcf41eb..ddbf9ee8f 100644 --- a/stdlib/source/lux/compiler/default/name.lux +++ b/stdlib/source/lux/compiler/default/name.lux @@ -36,7 +36,7 @@ (def: #export (normalize name) (-> Text Text) (let [name/size (text.size name)] - (loop [idx |0 + (loop [idx 0 output ""] (if (n/< name/size idx) (recur (inc idx) diff --git a/stdlib/source/lux/compiler/default/phase/analysis.lux b/stdlib/source/lux/compiler/default/phase/analysis.lux index ff540cded..cbd447d46 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis.lux @@ -107,7 +107,7 @@ (n/= (dec size) tag)) (template: #export (no-op value) - (|> |1 #reference.Local #reference.Variable #..Reference + (|> 1 #reference.Local #reference.Variable #..Reference (#..Function (list)) (#..Apply value))) @@ -117,11 +117,11 @@ (let [left (function.constant (|>> #.Left #Sum )) right (|>> #.Right #Sum )] (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 ( (#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 [ ] [(def: #export ( value) (-> (Maybe (Variant ))) - (loop [lefts |0 + (loop [lefts 0 variantA value] (case variantA ( (#Sum (#.Left valueA))) @@ -238,13 +238,13 @@ (def: fresh-bindings (All [k v] (Bindings k v)) - {#.counter |0 + {#.counter 0 #.mappings (list)}) (def: fresh-scope Scope {#.name (list) - #.inner |0 + #.inner 0 #.locals fresh-bindings #.captured fresh-bindings}) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux b/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux index 716c11bf1..df09bb0ec 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/case/coverage.lux @@ -19,11 +19,11 @@ (def: cases (-> (Maybe Nat) Nat) - (|>> (maybe.default |0))) + (|>> (maybe.default 0))) (def: (variant sum-side) (-> (Either Pattern Pattern) (Variant Pattern)) - (loop [lefts |0 + (loop [lefts 0 variantP sum-side] (case variantP (#.Left valueP) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/inference.lux b/stdlib/source/lux/compiler/default/phase/analysis/inference.lux index 1676c0cf7..c96d0457c 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/inference.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/inference.lux @@ -70,7 +70,7 @@ (^template [] ( env quantified) ( (list/map (replace parameter-idx replacement) env) - (replace (n/+ |2 parameter-idx) replacement quantified))) + (replace (n/+ 2 parameter-idx) replacement quantified))) ([#.UnivQ] [#.ExQ]) @@ -199,7 +199,7 @@ ## Turns a variant type into the kind of function type suitable for inference. (def: #export (variant tag expected-size inferT) (-> Nat Nat Type (Operation Type)) - (loop [depth |0 + (loop [depth 0 currentT inferT] (case currentT (#.Named name unnamedT) @@ -224,9 +224,9 @@ (n/< boundary tag))) (case (list.nth tag cases) (#.Some caseT) - (operation/wrap (if (n/= |0 depth) + (operation/wrap (if (n/= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n/* |2)) inferT)] + (let [replace' (replace (|> depth dec (n/* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT))))) @@ -238,9 +238,9 @@ (n/= boundary tag) (let [caseT (type.variant (list.drop boundary cases))] - (operation/wrap (if (n/= |0 depth) + (operation/wrap (if (n/= 0 depth) (type.function (list caseT) currentT) - (let [replace' (replace (|> depth dec (n/* |2)) inferT)] + (let [replace' (replace (|> depth dec (n/* 2)) inferT)] (type.function (list (replace' caseT)) (replace' currentT)))))) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/scope.lux b/stdlib/source/lux/compiler/default/phase/analysis/scope.lux index 6b6896674..2c34e7a44 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/scope.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/scope.lux @@ -43,7 +43,7 @@ (def: (captured name scope) (-> Text Scope (Maybe [Type Variable])) - (loop [idx |0 + (loop [idx 0 mappings (get@ [#.captured #.mappings] scope)] (case mappings #.Nil @@ -133,7 +133,7 @@ (do-template [ ] [(def: (Bindings Text [Type ]) - {#.counter |0 + {#.counter 0 #.mappings (list)})] [init-locals Nat] @@ -143,7 +143,7 @@ (def: (scope parent-name child-name) (-> (List Text) Text Scope) {#.name (list& child-name parent-name) - #.inner |0 + #.inner 0 #.locals init-locals #.captured init-captured}) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/structure.lux b/stdlib/source/lux/compiler/default/phase/analysis/structure.lux index 29203290a..f894679ef 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/structure.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/structure.lux @@ -312,7 +312,7 @@ _ (if (n/= size-ts size-record) (wrap []) (///.throw record-size-mismatch [size-ts size-record recordT record])) - #let [tuple-range (list.n/range |0 (dec size-ts)) + #let [tuple-range (list.n/range 0 (dec size-ts)) tag->idx (dict.from-list name.Hash (list.zip2 tag-set tuple-range))] idx->val (monad.fold @ (function (_ [key val] idx->val) diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux index d5ff4a085..d4e94a36f 100644 --- a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux @@ -82,7 +82,7 @@ (wrap (#analysis.Extension extension-name (list opA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: lux::in-module Handler @@ -108,7 +108,7 @@ ## (analyse valueC))) ## _ -## (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)]))))] +## (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)]))))] ## [lux::check (:coerce Type actualT)] ## [lux::coerce Any] @@ -126,7 +126,7 @@ (wrap valueA)) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: bundle::lux Bundle @@ -275,7 +275,7 @@ (wrap (#analysis.Extension extension-name (list initA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: atom::read Handler @@ -315,7 +315,7 @@ (wrap (#analysis.Extension extension-name (list initA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: box::read Handler diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux index 9e4cd2e7e..706d35e51 100644 --- a/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/host.jvm.lux @@ -231,7 +231,7 @@ (wrap (#analysis.Extension extension-name (list arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: array::new Handler @@ -244,7 +244,7 @@ expectedT (///.lift macro.expected-type) [level elem-class] (: (Operation [Nat Text]) (loop [analysisT expectedT - level |0] + level 0] (case analysisT (#.Apply inputT funcT) (case (type.apply (list inputT) funcT) @@ -262,7 +262,7 @@ _ (////.throw non-array expectedT)))) - _ (if (n/> |0 level) + _ (if (n/> 0 level) (wrap []) (////.throw non-array expectedT))] (wrap (#analysis.Extension extension-name (list (analysis.nat (dec level)) @@ -270,7 +270,7 @@ lengthA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: (check-jvm objectT) (-> Type (Operation Text)) @@ -344,7 +344,7 @@ (wrap (#analysis.Extension extension-name (list (analysis.text elem-class) idxA arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: array::write Handler @@ -366,7 +366,7 @@ (wrap (#analysis.Extension extension-name (list (analysis.text elem-class) idxA valueA arrayA)))) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: bundle::array Bundle @@ -389,7 +389,7 @@ (wrap (#analysis.Extension extension-name (list)))) _ - (////.throw bundle.incorrect-arity [extension-name |0 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 0 (list.size args)])))) (def: object::null? Handler @@ -404,7 +404,7 @@ (wrap (#analysis.Extension extension-name (list objectA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::synchronized Handler @@ -419,7 +419,7 @@ (wrap (#analysis.Extension extension-name (list monitorA exprA)))) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (host.import: java/lang/Object (equals [Object] boolean)) @@ -516,7 +516,7 @@ (wrap (#analysis.Extension extension-name (list exceptionA)))) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::class Handler @@ -534,7 +534,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |1 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 1 (list.size args)])))) (def: object::instance? Handler @@ -557,7 +557,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: (java-type-to-class jvm-type) (-> java/lang/reflect/Type (Operation Text)) @@ -588,8 +588,8 @@ (host.instance? WildcardType java-type) (let [java-type (:coerce WildcardType java-type)] - (case [(array.read |0 (WildcardType::getUpperBounds [] java-type)) - (array.read |0 (WildcardType::getLowerBounds [] java-type))] + (case [(array.read 0 (WildcardType::getUpperBounds [] java-type)) + (array.read 0 (WildcardType::getLowerBounds [] java-type))] (^or [(#.Some bound) _] [_ (#.Some bound)]) (java-type-to-lux-type mappings bound) @@ -600,13 +600,13 @@ (let [java-type (:coerce (Class Object) java-type) class-name (Class::getName [] java-type)] (operation/wrap (case (array.size (Class::getTypeParameters [] java-type)) - |0 + 0 (#.Primitive class-name (list)) arity - (|> (list.n/range |0 (dec arity)) + (|> (list.n/range 0 (dec arity)) list.reverse - (list/map (|>> (n/* |2) inc #.Parameter)) + (list/map (|>> (n/* 2) inc #.Parameter)) (#.Primitive class-name) (type.univ-q arity))))) @@ -831,7 +831,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |2 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 2 (list.size args)])))) (def: static::put Handler @@ -853,7 +853,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: virtual::get Handler @@ -872,7 +872,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |3 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 3 (list.size args)])))) (def: virtual::put Handler @@ -896,7 +896,7 @@ (////.throw bundle.invalid-syntax extension-name)) _ - (////.throw bundle.incorrect-arity [extension-name |4 (list.size args)])))) + (////.throw bundle.incorrect-arity [extension-name 4 (list.size args)])))) (def: (java-type-to-parameter type) (-> java/lang/reflect/Type (Operation Text)) @@ -970,11 +970,11 @@ (def: idx-to-parameter (-> Nat Type) - (|>> (n/* |2) inc #.Parameter)) + (|>> (n/* 2) inc #.Parameter)) (def: (type-vars amount offset) (-> Nat Nat (List Type)) - (if (n/= |0 amount) + (if (n/= 0 amount) (list) (|> (list.n/range offset (|> amount dec (n/+ offset))) (list/map idx-to-parameter)))) @@ -998,7 +998,7 @@ num-method-tvars (list.size method-tvars) all-tvars (list/compose owner-tvars method-tvars) num-all-tvars (list.size all-tvars) - owner-tvarsT (type-vars num-owner-tvars |0) + owner-tvarsT (type-vars num-owner-tvars 0) method-tvarsT (type-vars num-method-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) @@ -1086,7 +1086,7 @@ num-owner-tvars (list.size owner-tvars) all-tvars (list/compose owner-tvars constructor-tvars) num-all-tvars (list.size all-tvars) - owner-tvarsT (type-vars num-owner-tvars |0) + owner-tvarsT (type-vars num-owner-tvars 0) constructor-tvarsT (type-vars num-all-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis.lux b/stdlib/source/lux/compiler/default/phase/synthesis.lux index 28392eafd..1dbbffd84 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis.lux @@ -25,10 +25,10 @@ (def: #export init State - {#scope-arity |0 + {#scope-arity 0 #resolver fresh-resolver #direct? #0 - #locals |0}) + #locals 0}) (type: #export Primitive (#Bit Bit) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux b/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux index 0ab38afac..241896e58 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/expression.lux @@ -67,11 +67,11 @@ (do @ [arity //.scope-arity] (wrap (if (function.nested? arity) - (if (n/= |0 register) + (if (n/= 0 register) (|> (dec arity) - (list.n/range |1) + (list.n/range 1) (list/map (|>> //.variable/local)) - [(//.variable/local |0)] + [(//.variable/local 0)] //.function/apply) (#//.Reference (#reference.Variable (function.adjust arity #0 var)))) (#//.Reference (#reference.Variable var))))) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux index b7dd22f70..eadcd52b0 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/function.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/function.lux @@ -20,7 +20,7 @@ (def: #export nested? (-> Arity Bit) - (n/> |1)) + (n/> 1)) (def: #export (adjust up-arity after? var) (-> Arity Bit Variable Variable) @@ -90,7 +90,7 @@ resolver //.resolver #let [function-arity (if direct? (inc arity) - |1) + 1) up-environment (if (nested? arity) (list/map (.function (_ closure) (case (dict.get closure resolver) @@ -107,7 +107,7 @@ (list) _ - (|> (list.size environment) dec (list.n/range |0) + (|> (list.size environment) dec (list.n/range 0) (list/map (|>> #reference.Foreign))))) resolver' (if (and (nested? function-arity) direct?) @@ -129,6 +129,6 @@ ..return)) _ - (|> (prepare function-arity |1 bodyS) - (maybe/map (|>> [up-environment |1] //.function/abstraction)) + (|> (prepare function-arity 1 bodyS) + (maybe/map (|>> [up-environment 1] //.function/abstraction)) ..return)))) diff --git a/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux b/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux index 4bae596c3..e7db982d8 100644 --- a/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux +++ b/stdlib/source/lux/compiler/default/phase/synthesis/loop.lux @@ -27,7 +27,7 @@ #.None #0)) (template: #export (self) - (#//.Reference (reference.local |0))) + (#//.Reference (reference.local 0))) (template: (recursive-apply args) (#//.Apply (self) args)) diff --git a/stdlib/source/lux/compiler/default/phase/translation.lux b/stdlib/source/lux/compiler/default/phase/translation.lux index ec67565d6..f9d61c4af 100644 --- a/stdlib/source/lux/compiler/default/phase/translation.lux +++ b/stdlib/source/lux/compiler/default/phase/translation.lux @@ -76,12 +76,12 @@ (-> (Host expression statement) (..State anchor expression statement))) {#context {#scope-name "" - #inner-functions |0} + #inner-functions 0} #anchor #.None #host host #buffer #.None #artifacts (dict.new text.Hash) - #counter |0}) + #counter 0}) (def: #export (with-context expr) (All [anchor expression statement output] @@ -90,7 +90,7 @@ (function (_ [bundle state]) (let [[old-scope old-inner] (get@ #context state) new-scope (format old-scope "c___" (%i (.int old-inner)))] - (case (expr [bundle (set@ #context [new-scope |0] state)]) + (case (expr [bundle (set@ #context [new-scope 0] state)]) (#error.Success [[bundle' state'] output]) (#error.Success [[bundle' (set@ #context [old-scope (inc old-inner)] state')] [new-scope output]]) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux index b1dce6688..9952a754d 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux @@ -30,10 +30,10 @@ (syntax: (Vector {size s.nat} elemT) (wrap (list (` [(~+ (list.repeat size elemT))])))) -(type: #export Nullary (-> (Vector |0 Expression) Computation)) -(type: #export Unary (-> (Vector |1 Expression) Computation)) -(type: #export Binary (-> (Vector |2 Expression) Computation)) -(type: #export Trinary (-> (Vector |3 Expression) Computation)) +(type: #export Nullary (-> (Vector 0 Expression) Computation)) +(type: #export Unary (-> (Vector 1 Expression) Computation)) +(type: #export Binary (-> (Vector 2 Expression) Computation)) +(type: #export Trinary (-> (Vector 3 Expression) Computation)) (type: #export Variadic (-> (List Expression) Computation)) ## [Utils] @@ -55,12 +55,12 @@ ((~' wrap) ((~ g!extension) [(~+ g!input+)]))) (~' _) - (/////.throw bundle.incorrect-arity [(~ g!name) |1 (list.size (~ g!inputs))])))))))))) + (/////.throw bundle.incorrect-arity [(~ g!name) 1 (list.size (~ g!inputs))])))))))))) -(arity: nullary |0) -(arity: unary |1) -(arity: binary |2) -(arity: trinary |3) +(arity: nullary 0) +(arity: unary 1) +(arity: binary 2) +(arity: trinary 3) (def: #export (variadic extension) (-> Variadic Handler) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux index bf65a7606..d4316a0b5 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/function.jvm.lux @@ -70,8 +70,8 @@ (_.letrec (list [@function (_.lambda [(list) (#.Some @curried)] (_.let (list [@num-args (_.length/1 @curried)]) (<| (_.if (|> @num-args (_.=/2 arityO)) - (<| (_.let (list [(reference.local' |0) @function])) - (_.let-values (list [[(|> (list.n/range |0 (dec arity)) + (<| (_.let (list [(reference.local' 0) @function])) + (_.let-values (list [[(|> (list.n/range 0 (dec arity)) (list/map ..input)) #.None] (_.apply/2 (_.global "apply") (_.global "values") @curried)])) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux index d72312693..2ec83227d 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux @@ -58,19 +58,19 @@ (def: #export none Computation - (variant [|0 #0 ..unit])) + (variant [0 #0 ..unit])) (def: #export some (-> Expression Computation) - (|>> [|0 #1] ..variant)) + (|>> [0 #1] ..variant)) (def: #export left (-> Expression Computation) - (|>> [|0 #0] ..variant)) + (|>> [0 #0] ..variant)) (def: #export right (-> Expression Computation) - (|>> [|0 #1] ..variant)) + (|>> [0 #1] ..variant)) (def: declaration (s.Syntax [Text (List Text)]) diff --git a/stdlib/source/lux/compiler/default/reference.lux b/stdlib/source/lux/compiler/default/reference.lux index 1c94c0349..0bbeb2db5 100644 --- a/stdlib/source/lux/compiler/default/reference.lux +++ b/stdlib/source/lux/compiler/default/reference.lux @@ -31,10 +31,10 @@ (def: (hash var) (case var (#Local register) - (n/* |1 register) + (n/* 1 register) (#Foreign register) - (n/* |2 register)))) + (n/* 2 register)))) (do-template [ ] [(template: #export ( content) @@ -55,12 +55,12 @@ [constant #..Constant] ) -(def: #export self Reference (..local |0)) +(def: #export self Reference (..local 0)) (def: #export self? (-> Variable Bit) (|>> ..variable - (case> (^ (..local |0)) + (case> (^ (..local 0)) #1 _ diff --git a/stdlib/source/lux/compiler/default/repl/type.lux b/stdlib/source/lux/compiler/default/repl/type.lux index e6d25a76a..212c5bcb9 100644 --- a/stdlib/source/lux/compiler/default/repl/type.lux +++ b/stdlib/source/lux/compiler/default/repl/type.lux @@ -110,7 +110,7 @@ (n/= num-tags (list.size casesR+)))] (wrap (function (_ variantV) (loop [cases-left (list.zip3 tags - (list.n/range |0 (dec num-tags)) + (list.n/range 0 (dec num-tags)) casesR+) variantV variantV] (case cases-left diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux index f88cedc9b..0497f55a2 100644 --- a/stdlib/source/lux/compiler/default/syntax.lux +++ b/stdlib/source/lux/compiler/default/syntax.lux @@ -64,7 +64,7 @@ [content (l.many (l.one-of new-line))] (wrap [(|> where (update@ #.line (n/+ (text.size content))) - (set@ #.column |0)) + (set@ #.column 0)) content])) )) @@ -78,7 +78,7 @@ _ (l.this new-line)] (wrap [(|> where (update@ #.line inc) - (set@ #.column |0)) + (set@ #.column 0)) comment]))) ## This is just a helper parser to find text which doesn't run into @@ -100,7 +100,7 @@ (do p.Monad [_ (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 - [code (l.between |1 |4 l.hexadecimal)] + [code (l.between 1 4 l.hexadecimal)] (wrap (case (|> code (format "+") (:: number.Hex@Codec decode)) (#.Right value) - [(n/+ |2 (text.size code)) (text.from-code value)] + [(n/+ 2 (text.size code)) (text.from-code value)] _ (undefined)))) @@ -251,7 +251,7 @@ (update@ #.column (n/+ chars-consumed))) char])))) _ (l.this "\"") - #let [char (maybe.assume (text.nth |0 char))]] + #let [char (maybe.assume (text.nth 0 char))]] (wrap [(|> where' (update@ #.column inc)) [where (#.Nat char)]]))) @@ -412,7 +412,7 @@ (recur (format text-read new-line) (|> where (update@ #.line inc) - (set@ #.column |0)) + (set@ #.column 0)) #1)))))] (wrap [where' [where (#.Text text-read)]]))) @@ -529,7 +529,7 @@ [_ (l.this current-module-mark) def-name name-part^] (wrap [[current-module def-name] - (n/+ |2 (text.size def-name))])) + (n/+ 2 (text.size def-name))])) ## If the name is prefixed by the mark, but no module ## part, the module is assumed to be "lux" (otherwise known as ## the 'prelude'). @@ -559,7 +559,7 @@ second-part] ($_ n/+ (text.size first-part) - |1 + 1 (text.size second-part))])) (wrap [["" first-part] (text.size first-part)]))))) @@ -569,7 +569,7 @@ (do p.Monad [[value length] (p.after (l.this "#") (name^ current-module aliases))] - (wrap [(update@ #.column (|>> ($_ n/+ |1 length)) where) + (wrap [(update@ #.column (|>> ($_ n/+ 1 length)) where) [where (#.Tag value)]]))) (def: #export (identifier current-module aliases where) diff --git a/stdlib/source/lux/compiler/meta/io/archive.lux b/stdlib/source/lux/compiler/meta/io/archive.lux index 27c7416f0..1f0714b25 100644 --- a/stdlib/source/lux/compiler/meta/io/archive.lux +++ b/stdlib/source/lux/compiler/meta/io/archive.lux @@ -67,7 +67,7 @@ (#.Some ["" post]) (let [raw (text.replace-all (:: System separator) "/" post)] (if (text.starts-with? "/" raw) - (text.clip' |1 raw) + (text.clip' 1 raw) (#.Some raw))) _ diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index da76351c4..f6a6fbe0d 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -335,11 +335,11 @@ (if (list.empty? actor-vars) (list) (|> actor-vars list.size dec - (list.n/range |0) (list/map (|>> code.nat (~) ($) (`)))))) + (list.n/range 0) (list/map (|>> code.nat (~) ($) (`)))))) ref-replacements (|> (if (list.empty? actor-vars) (list) (|> actor-vars list.size dec - (list.n/range |0) (list/map (|>> code.nat (~) ($) (`))))) + (list.n/range 0) (list/map (|>> code.nat (~) ($) (`))))) (: (List Code)) (list.zip2 g!all-vars) (: (List [Code Code]))) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 6e2450068..7062c2082 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -155,7 +155,7 @@ (def: #export future {#.doc "Runs an I/O computation on its own process and returns a Promise that will eventually host its result."} (All [a] (-> (IO a) (Promise a))) - (schedule |0)) + (schedule 0)) (def: #export (delay time-millis value) {#.doc "Delivers a value after a certain period has passed."} diff --git a/stdlib/source/lux/concurrency/semaphore.lux b/stdlib/source/lux/concurrency/semaphore.lux index 5b1688048..7b749ea60 100644 --- a/stdlib/source/lux/concurrency/semaphore.lux +++ b/stdlib/source/lux/concurrency/semaphore.lux @@ -33,8 +33,8 @@ [state (atom.read semaphore) #let [[ready? state'] (: [Bit State] (case (get@ #open-positions state) - |0 [#0 (update@ #waiting-list (|>> (#.Cons signal)) - state)] + 0 [#0 (update@ #waiting-list (|>> (#.Cons signal)) + state)] _ [#1 (update@ #open-positions dec state)]))] success? (atom.compare-and-swap state state' semaphore) @@ -79,7 +79,7 @@ (def: #export (mutex _) (-> Any Mutex) - (:abstraction (semaphore |1))) + (:abstraction (semaphore 1))) (def: (acquire mutex) (-> Mutex (Promise Any)) @@ -98,7 +98,7 @@ (wrap output))) ) -(def: #export limit (refinement.refinement (n/> |0))) +(def: #export limit (refinement.refinement (n/> 0))) (`` (type: #export Limit (~~ (refinement.type limit)))) (abstract: #export Barrier @@ -112,13 +112,13 @@ (def: #export (barrier limit) (-> Limit Barrier) (:abstraction {#limit limit - #count (atom.atom |0) - #start-turnstile (semaphore |0) - #end-turnstile (semaphore |0)})) + #count (atom.atom 0) + #start-turnstile (semaphore 0) + #end-turnstile (semaphore 0)})) (def: (un-block times turnstile) (-> Nat Semaphore (Promise Any)) - (loop [step |0] + (loop [step 0] (if (n/< times step) (do promise.Monad [_ (signal turnstile)] @@ -138,7 +138,7 @@ (wait (get@ barrier))))] [start inc limit #start-turnstile] - [end dec |0 #end-turnstile] + [end dec 0 #end-turnstile] ) (def: #export (block barrier) diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 7efe24942..23a059ae4 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -26,7 +26,7 @@ [a (F (CoFree F a))]) ## [Syntax] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) (macro: #export (be tokens state) {#.doc (doc "A co-monadic parallel to the \"do\" macro." @@ -36,7 +36,7 @@ (square (head inputs)))))} (case tokens (#.Cons comonad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) - (if (|> bindings list.size (n/% |2) (n/= |0)) + (if (|> bindings list.size (n/% 2) (n/= 0)) (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) g!map (: Code [_cursor (#.Identifier ["" " map "])]) g!split (: Code [_cursor (#.Identifier ["" " split "])]) diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index 47c3ea4ca..0011c8956 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -129,7 +129,7 @@ (~ type) (|>> (~+ (list/map prepare commands)))))))) -(syntax: #export (apply {arity (|> s.nat (p.filter (.n/> |0)))}) +(syntax: #export (apply {arity (|> s.nat (p.filter (.n/> 0)))}) (with-gensyms [g! g!func g!stack g!output] (monad.do @ [g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq @))] @@ -141,14 +141,14 @@ [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) ## [Primitives] -(def: #export apply1 (apply |1)) -(def: #export apply2 (apply |2)) -(def: #export apply3 (apply |3)) -(def: #export apply4 (apply |4)) -(def: #export apply5 (apply |5)) -(def: #export apply6 (apply |6)) -(def: #export apply7 (apply |7)) -(def: #export apply8 (apply |8)) +(def: #export apply1 (apply 1)) +(def: #export apply2 (apply 2)) +(def: #export apply3 (apply 3)) +(def: #export apply4 (apply 4)) +(def: #export apply5 (apply 5)) +(def: #export apply6 (apply 6)) +(def: #export apply7 (apply 7)) +(def: #export apply8 (apply 8)) (def: #export (push x) (All [a] (-> a (=> [] [a]))) @@ -193,12 +193,12 @@ (def: #export ||L (All [a b] (=> [a] [(| a b)])) (function (_ [stack l]) - [stack (|0 l)])) + [stack (0 l)])) (def: #export ||R (All [a b] (=> [b] [(| a b)])) (function (_ [stack r]) - [stack (|1 r)])) + [stack (1 r)])) (do-template [ ] [(def: #export diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux index 5f9ca37b6..c10b0c295 100644 --- a/stdlib/source/lux/control/equivalence.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -15,10 +15,10 @@ (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) (structure (def: (= a|b x|y) (case [a|b x|y] - [(|0 a) (|0 x)] + [(0 a) (0 x)] (:: left = a x) - [(|1 b) (|1 y)] + [(1 b) (1 y)] (:: right = b y) _ diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index 66c7ebf7b..d2e9c705d 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -116,7 +116,7 @@ (-> (List [Text Text]) Text) (let [largest-header-size (|> entries (list/map (|>> product.left text.size)) - (list/fold n/max |0))] + (list/fold n/max 0))] (|> entries (list/map (function (_ [header message]) (let [padding (|> " " diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index e3196faf5..36b2354fc 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -16,7 +16,7 @@ (def: (list/size xs) (All [a] (-> (List a) Nat)) - (loop [counter |0 + (loop [counter 0 xs xs] (case xs #.Nil @@ -53,7 +53,7 @@ join)) ## [Syntax] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) (macro: #export (do tokens state) {#.doc (doc "Macro for easy concatenation of monadic operations." @@ -63,7 +63,7 @@ (wrap (f3 z))))} (case tokens (#.Cons monad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) - (if (|> bindings list/size (n/% |2) (n/= |0)) + (if (|> bindings list/size (n/% 2) (n/= 0)) (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) g!map (: Code [_cursor (#.Identifier ["" " map "])]) g!join (: Code [_cursor (#.Identifier ["" " join "])]) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 48119eaa5..c40de3373 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -119,11 +119,11 @@ (-> (Parser s a) (Parser s b) (Parser s (| a b)))) (function (_ tokens) (case (p1 tokens) - (#e.Success [tokens' x1]) (#e.Success [tokens' (|0 x1)]) + (#e.Success [tokens' x1]) (#e.Success [tokens' (0 x1)]) (#e.Error _) (run tokens (do Monad [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 [x p xs (exactly (dec n) p)] @@ -157,7 +157,7 @@ (def: #export (at-most n p) {#.doc "Parse at most N times."} (All [s a] (-> Nat (Parser s a) (Parser s (List a)))) - (if (n/> |0 n) + (if (n/> 0 n) (function (_ input) (case (p input) (#e.Error msg) diff --git a/stdlib/source/lux/control/pipe.lux b/stdlib/source/lux/control/pipe.lux index a9a97b0c9..c23723f6d 100644 --- a/stdlib/source/lux/control/pipe.lux +++ b/stdlib/source/lux/control/pipe.lux @@ -16,7 +16,7 @@ (Syntax (List Code)) (s.tuple (p.some s.any))) -(syntax: #export (new> {tokens (p.at-least |2 s.any)}) +(syntax: #export (new> {tokens (p.at-least 2 s.any)}) {#.doc (doc "Ignores the piped argument, and begins a new pipe." (|> +20 (i/* +3) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index fc964537c..4007cb6cb 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -60,7 +60,7 @@ (def: (join MlMla) (do Monad [## TODO: Remove once new-luxc is the standard compiler. - [l1 Mla] (: (($ |1) (Writer ($ |0) (($ |1) (Writer ($ |0) ($ |2))))) + [l1 Mla] (: (($ 1) (Writer ($ 0) (($ 1) (Writer ($ 0) ($ 2))))) MlMla) ## [l1 Mla] MlMla [l2 a] Mla] diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index 8b61d8b32..026f8bcab 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -18,8 +18,8 @@ (def: eq Equivalence) (def: (hash value) (case value - #1 |1 - #0 |0))) + #1 1 + #0 0))) (do-template [ ] [(structure: #export (Monoid Bit) diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index 588c5132b..1d64511a9 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -38,7 +38,7 @@ (All [a] (-> Nat Nat (Array a) Nat (Array a) (Array a))) - (if (n/= |0 length) + (if (n/= 0 length) dest-array (list/fold (function (_ offset target) (case (read (n/+ offset src-start) src-array) @@ -48,7 +48,7 @@ (#.Some value) (write (n/+ offset dest-start) value target))) dest-array - (list.n/range |0 (dec length))))) + (list.n/range 0 (dec length))))) (def: #export (occupied array) {#.doc "Finds out how many cells in an array are occupied."} @@ -60,7 +60,7 @@ (#.Some _) (inc count))) - |0 + 0 (list.indices (size array)))) (def: #export (vacant array) @@ -87,7 +87,7 @@ (All [a] (-> (-> a Bit) (Array a) (Maybe a))) (let [arr-size (size xs)] - (loop [idx |0] + (loop [idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -104,7 +104,7 @@ (All [a] (-> (-> Nat a Bit) (Array a) (Maybe [Nat a]))) (let [arr-size (size xs)] - (loop [idx |0] + (loop [idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -133,10 +133,10 @@ (All [a] (-> (List a) (Array a))) (product.right (list/fold (function (_ x [idx arr]) [(inc idx) (write idx x arr)]) - [|0 (new (list.size xs))] + [0 (new (list.size xs))] xs))) -(def: underflow Nat (dec |0)) +(def: underflow Nat (dec 0)) (def: #export (to-list array) (All [a] (-> (Array a) (List a))) @@ -170,23 +170,23 @@ _ #0))) #1 - (list.n/range |0 (dec sxs))))) + (list.n/range 0 (dec sxs))))) )) (structure: #export Monoid (All [a] (Monoid (Array a))) - (def: identity (new |0)) + (def: identity (new 0)) (def: (compose xs ys) (let [sxs (size xs) sxy (size ys)] (|> (new (n/+ sxy sxs)) - (copy sxs |0 xs |0) - (copy sxy |0 ys sxs))))) + (copy sxs 0 xs 0) + (copy sxy 0 ys sxs))))) (structure: #export _ (Functor Array) (def: (map f ma) (let [arr-size (size ma)] - (if (n/= |0 arr-size) + (if (n/= 0 arr-size) (new arr-size) (list/fold (function (_ idx mb) (case (read idx ma) @@ -196,14 +196,14 @@ (#.Some x) (write idx (f x) mb))) (new arr-size) - (list.n/range |0 (dec arr-size))) + (list.n/range 0 (dec arr-size))) )))) (structure: #export _ (Fold Array) (def: (fold f init xs) (let [arr-size (size xs)] (loop [so-far init - idx |0] + idx 0] (if (n/< arr-size idx) (case (read idx xs) #.None @@ -218,7 +218,7 @@ (All [a] (-> (Predicate a) (Array a) Bit)) (let [size (..size array)] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (case (..read idx array) (#.Some value) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 5caec8eb7..66cb2dab7 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -19,17 +19,17 @@ (type: #export Bits (Array Chunk)) -(def: empty-chunk Chunk (.i64 |0)) +(def: empty-chunk Chunk (.i64 0)) (def: #export empty Bits - (array.new |0)) + (array.new 0)) (def: #export (size bits) (-> Bits Nat) (array/fold (function (_ chunk total) (|> chunk i64.count (n/+ total))) - |0 + 0 bits)) (def: #export (capacity bits) @@ -38,7 +38,7 @@ (def: #export empty? (-> Bits Bit) - (|>> size (n/= |0))) + (|>> size (n/= 0))) (def: #export (get index bits) (-> Nat Bits Bit) @@ -62,7 +62,7 @@ (array.size input)) output ..empty] (let [idx|output (dec size|output)] - (if (n/> |0 size|output) + (if (n/> 0 size|output) (case (|> (..chunk idx|output input) (cond> [(new> (n/= chunk-index idx|output))] [( 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) ( (..chunk idx param)) .nat) - |0 + 0 (recur (dec size|output) output) chunk @@ -160,7 +160,7 @@ (def: (= reference sample) (let [size (n/max (array.size reference) (array.size sample))] - (loop [idx |0] + (loop [idx 0] (if (n/< size idx) (.and ("lux i64 =" (..chunk idx reference) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 64c577946..3d4e84207 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -41,7 +41,7 @@ ## the appropriate multiple of the branching-exponent. ## A shift of 0 means root level. ## A shift of (* branching-exponent 1) means level 2. -## A shift of (* branching-exponent N) means level N|1. +## A shift of (* branching-exponent N) means level N+1. (type: Level Nat) ## Nodes for the tree data-structure that organizes the data inside @@ -75,7 +75,7 @@ ## Which is 32 zeroes, since the branching factor is 32. (def: clean-bitmap BitMap - |0) + 0) ## Bitmap position (while looking inside #Base nodes) is determined by ## getting 5 bits from a hash of the key being looked up and using @@ -88,35 +88,35 @@ ## shift in the shallowest node on the tree, which is the root node). (def: root-level Level - |0) + 0) ## The exponent to which 2 must be elevated, to reach the branching ## factor of the data-structure. (def: branching-exponent Nat - |5) + 5) ## The threshold on which #Hierarchy nodes are demoted to #Base nodes, ## which is 1/4 of the branching factor (or a left-shift 2). (def: demotion-threshold Nat - (i64.left-shift (n/- |2 branching-exponent) |1)) + (i64.left-shift (n/- 2 branching-exponent) 1)) ## The threshold on which #Base nodes are promoted to #Hierarchy nodes, ## which is 1/2 of the branching factor (or a left-shift 1). (def: promotion-threshold Nat - (i64.left-shift (n/- |1 branching-exponent) |1)) + (i64.left-shift (n/- 1 branching-exponent) 1)) ## The size of hierarchy-nodes, which is 2^(branching-exponent). (def: hierarchy-nodes-size Nat - (i64.left-shift branching-exponent |1)) + (i64.left-shift branching-exponent 1)) ## The cannonical empty node, which is just an empty #Base node. (def: empty Node - (#Base clean-bitmap (array.new |0))) + (#Base clean-bitmap (array.new 0))) ## Expands a copy of the array, to have 1 extra slot, which is used ## for storing the value. @@ -124,7 +124,7 @@ (All [a] (-> Index a (Array a) (Array a))) (let [old-size (array.size old-array)] (|> (array.new (inc old-size)) - (array.copy idx |0 old-array |0) + (array.copy idx 0 old-array 0) (array.write idx value) (array.copy (n/- idx old-size) idx old-array (inc idx))))) @@ -143,13 +143,13 @@ (All [a] (-> Index (Array a) (Array a))) (let [new-size (dec (array.size array))] (|> (array.new new-size) - (array.copy idx |0 array |0) + (array.copy idx 0 array 0) (array.copy (n/- idx new-size) (inc idx) array idx)))) ## Given a top-limit for indices, produces all indices in [0, R). (def: indices-for (-> Nat (List Index)) - (|>> dec (list.n/range |0))) + (|>> dec (list.n/range 0))) ## Increases the level-shift by the branching-exponent, to explore ## levels further down the tree. @@ -169,7 +169,7 @@ ## A mechanism to go from indices to bit-positions. (def: (->bit-position index) (-> Index BitPosition) - (i64.left-shift index |1)) + (i64.left-shift index 1)) ## The bit-position within a base that a given hash-code would have. (def: (bit-position level hash) @@ -234,8 +234,8 @@ [(set-bit-position (->bit-position idx) bitmap) (array.write insertion-idx (#.Left sub-node) base)]]) ))) - [|0 [clean-bitmap - (array.new (dec h-size))]] + [0 [clean-bitmap + (array.new (dec h-size))]] (list.indices (array.size h-array))))) ## When #Base nodes grow too large, they're promoted to #Hierarchy to @@ -264,7 +264,7 @@ #.None (undefined))] default)) - [|0 + [0 (array.new hierarchy-nodes-size)] hierarchy-indices))) @@ -326,9 +326,9 @@ ## the same, a new ## #Collisions node ## is added. - (#Collisions hash (|> (array.new |2) - (array.write |0 [key' val']) - (array.write |1 [key val]))) + (#Collisions hash (|> (array.new 2) + (array.write 0 [key' val']) + (array.write 1 [key val]))) ## Otherwise, I can ## just keep using ## #Base nodes, so I @@ -371,8 +371,8 @@ ## If the hashes are not equal, I create a new #Base node that ## contains the old #Collisions node, plus the new KV-pair. (|> (#Base (bit-position level _hash) - (|> (array.new |1) - (array.write |0 (#.Left node)))) + (|> (array.new 1) + (array.write 0 (#.Left node)))) (put' level hash key val Hash))) )) @@ -460,7 +460,7 @@ ## But if so, then check the size of the collisions list. (#.Some idx) - (if (n/= |1 (array.size _colls)) + (if (n/= 1 (array.size _colls)) ## If there's only one left, then removing it leaves us with ## an empty node. empty @@ -505,14 +505,14 @@ (All [k v] (-> (Node k v) Nat)) (case node (#Hierarchy _size hierarchy) - (array/fold n/+ |0 (array/map size' hierarchy)) + (array/fold n/+ 0 (array/map size' hierarchy)) (#Base _ base) - (array/fold n/+ |0 (array/map (function (_ sub-node') - (case sub-node' - (#.Left sub-node) (size' sub-node) - (#.Right _) |1)) - base)) + (array/fold n/+ 0 (array/map (function (_ sub-node') + (case sub-node' + (#.Left sub-node) (size' sub-node) + (#.Right _) 1)) + base)) (#Collisions hash colls) (array.size colls) @@ -605,7 +605,7 @@ (def: #export empty? (All [k v] (-> (Dictionary k v) Bit)) - (|>> size (n/= |0))) + (|>> size (n/= 0))) (def: #export (entries dict) (All [k v] (-> (Dictionary k v) (List [k v]))) diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index 38442f93d..25c50367b 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -115,7 +115,7 @@ (loop [node (get@ #root dict)] (case node #.None - |0 + 0 (#.Some node) (inc ( (recur (get@ #left node)) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index d7a2145c6..09328def9 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -68,7 +68,7 @@ [(def: #export ( 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 [ ] [(def: #export ( p xs) @@ -261,7 +261,7 @@ #.None (#.Cons [x xs']) - (if (n/= |0 i) + (if (n/= 0 i) (#.Some x) (nth (dec i) xs')))) @@ -382,40 +382,40 @@ ## [Syntax] (def: (identifier$ name) (-> Text Code) - [["" |0 |0] (#.Identifier "" name)]) + [["" 0 0] (#.Identifier "" name)]) (def: (nat/encode value) (-> Nat Text) (loop [input value output ""] - (let [digit (case (n/% |10 input) - |0 "0" - |1 "1" - |2 "2" - |3 "3" - |4 "4" - |5 "5" - |6 "6" - |7 "7" - |8 "8" - |9 "9" + (let [digit (case (n/% 10 input) + 0 "0" + 1 "1" + 2 "2" + 3 "3" + 4 "4" + 5 "5" + 6 "6" + 7 "7" + 8 "8" + 9 "9" _ (undefined)) output' ("lux text concat" digit output) - input' (n// |10 input)] - (if (n/= |0 input') + input' (n// 10 input)] + (if (n/= 0 input') ("lux text concat" "+" output') (recur input' output'))))) (macro: #export (zip tokens state) {#.doc (doc "Create list zippers with the specified number of input lists." - (def: #export zip2 (zip |2)) - (def: #export zip3 (zip |3)) - ((zip |3) xs ys zs))} + (def: #export zip2 (zip 2)) + (def: #export zip3 (zip 3)) + ((zip 3) xs ys zs))} (case tokens (^ (list [_ (#.Nat num-lists)])) - (if (n/> |0 num-lists) + (if (n/> 0 num-lists) (let [(^open ".") Functor - 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 - 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 [lMla MlMla ## TODO: Remove this version ASAP and use one below. - lla (: (($ |0) (List (List ($ |1)))) + lla (: (($ 0) (List (List ($ 1)))) (monad.seq @ lMla)) ## lla (monad.seq @ lMla) ] @@ -567,11 +567,11 @@ (def: #export (enumerate xs) {#.doc "Pairs every element in the list with its index, starting at 0."} (All [a] (-> (List a) (List [Nat a]))) - (enumerate' |0 xs)) + (enumerate' 0 xs)) (def: #export (indices size) {#.doc "Produces all the valid indices for a given size."} (All [a] (-> Nat (List Nat))) - (if (n/= |0 size) + (if (n/= 0 size) (list) - (|> size dec (n/range |0)))) + (|> size dec (n/range 0)))) diff --git a/stdlib/source/lux/data/collection/queue/priority.lux b/stdlib/source/lux/data/collection/queue/priority.lux index a5aa7dd73..1af9acaab 100644 --- a/stdlib/source/lux/data/collection/queue/priority.lux +++ b/stdlib/source/lux/data/collection/queue/priority.lux @@ -32,13 +32,13 @@ (All [a] (-> (Queue a) Nat)) (case queue #.None - |0 + 0 (#.Some fingers) (loop [node (get@ #finger.node fingers)] (case node (#finger.Leaf _ _) - |1 + 1 (#finger.Branch _ left right) (n/+ (recur left) (recur right)))))) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index c9e2c6786..3951aadd1 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -35,11 +35,11 @@ (def: branching-exponent Nat - |5) + 5) (def: root-level Level - |0) + 0) (do-template [ ] [(def: @@ -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 - [new-tail (base-for (n/- |2 vec-size) vec) + [new-tail (base-for (n/- 2 vec-size) vec) #let [[level' root'] (let [init-level (get@ #level vec)] (loop [level init-level root (maybe.default (new-hierarchy []) (pop-tail vec-size init-level (get@ #root vec)))] (if (n/> branching-exponent level) - (case [(array.read |1 root) (array.read |0 root)] + (case [(array.read 1 root) (array.read 0 root)] [#.None (#.Some (#Hierarchy sub-node))] (recur (level-down level) sub-node) @@ -338,7 +338,7 @@ (def: #export empty? (All [a] (-> (Row a) Bit)) - (|>> (get@ #size) (n/= |0))) + (|>> (get@ #size) (n/= 0))) ## [Syntax] (syntax: #export (row {elems (p.some s.any)}) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index ed06547c2..6529a1ced 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -62,7 +62,7 @@ (def: #export (nth idx s) (All [a] (-> Nat (Sequence a) a)) (let [[h t] (continuation.run s)] - (if (n/> |0 idx) + (if (n/> 0 idx) (nth (dec idx) t) h))) @@ -93,7 +93,7 @@ [(list) xs])))] [take-while drop-while split-while (-> a Bit) (pred x) pred] - [take drop split Nat (n/> |0 pred) (dec pred)] + [take drop split Nat (n/> 0 pred) (dec pred)] ) (def: #export (unfold step init) diff --git a/stdlib/source/lux/data/collection/set.lux b/stdlib/source/lux/data/collection/set.lux index cab4105b0..6de27eb24 100644 --- a/stdlib/source/lux/data/collection/set.lux +++ b/stdlib/source/lux/data/collection/set.lux @@ -65,13 +65,13 @@ (def: (hash set) (let [[Hash _] (:representation set)] (list/fold (function (_ elem acc) (n/+ (:: Hash 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 xs) (All [a] (-> (Hash a) (List a) (Set a))) diff --git a/stdlib/source/lux/data/collection/set/multi.lux b/stdlib/source/lux/data/collection/set/multi.lux index 91fd7f675..d152c8506 100644 --- a/stdlib/source/lux/data/collection/set/multi.lux +++ b/stdlib/source/lux/data/collection/set/multi.lux @@ -25,15 +25,15 @@ (def: #export size (All [a] (-> (Set a) Nat)) - (|>> :representation dictionary.values (list/fold n/+ |0))) + (|>> :representation dictionary.values (list/fold n/+ 0))) (def: #export (add/* count elem set) (All [a] (-> Nat a (Set a) (Set a))) - (|> set :representation (dictionary.update~ elem |0 (n/+ count)) :abstraction)) + (|> set :representation (dictionary.update~ elem 0 (n/+ count)) :abstraction)) (def: #export add/1 (All [a] (-> a (Set a) (Set a))) - (add/* |1)) + (add/* 1)) (def: #export (remove/* count elem set) (All [a] (-> Nat a (Set a) (Set a))) @@ -53,18 +53,18 @@ (def: #export remove/1 (All [a] (-> a (Set a) (Set a))) - (remove/* |1)) + (remove/* 1)) (def: #export (multiplicity elem set) (All [a] (-> a (Set a) Nat)) - (|> set :representation (dictionary.get elem) (maybe.default |0))) + (|> set :representation (dictionary.get elem) (maybe.default 0))) (def: #export to-list (All [a] (-> (Set a) (List a))) (let [append (: (All [a] (-> a Nat (List a) (List a))) (function (append elem count output) (case count - |0 output + 0 output _ (|> output (#.Cons elem) (append elem (dec count))))))] (|>> :representation dictionary.entries @@ -105,7 +105,7 @@ (|> reference :representation (dictionary.get elem) - (maybe.default |0) + (maybe.default 0) (n/>= count)))))) (def: #export (support set) @@ -124,7 +124,7 @@ (list.every? (function (_ [elem count]) (|> sample (dictionary.get elem) - (maybe.default |0) + (maybe.default 0) (n/= count)))))))) (structure: #export Hash (All [a] (Hash (Set a))) @@ -134,17 +134,17 @@ (let [[Hash _] set] (list/fold (function (_ [elem count] acc) (|> elem (:: Hash 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 subject) (All [a] (-> (Hash a) (List a) (Set a))) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index b732f87b2..f9380577b 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -86,7 +86,7 @@ (#.Some parent) (|> parent ## TODO: Remove once new-luxc becomes the standard compiler. - (update@ #node (: (-> (Tree ($ |0)) (Tree ($ |0))) + (update@ #node (: (-> (Tree ($ 0)) (Tree ($ 0))) (function (_ node) (set@ #//.children (list/compose (list.reverse (get@ #lefts zipper)) (#.Cons (get@ #node zipper) @@ -155,7 +155,7 @@ (update@ [#node #//.children] (function (_ children) ## TODO: Remove once new-luxc becomes the standard compiler. - (list& (: (Tree ($ |0)) + (list& (: (Tree ($ 0)) (//.tree [value {}])) children) ## (list& (//.tree [value {}]) @@ -169,7 +169,7 @@ (function (_ children) (list/compose children ## TODO: Remove once new-luxc becomes the standard compiler. - (list (: (Tree ($ |0)) + (list (: (Tree ($ 0)) (//.tree [value {}]))) ## (list (//.tree [value {}])) )) @@ -203,7 +203,7 @@ (#.Some (|> zipper (update@ (function (_ side) ## TODO: Remove once new-luxc becomes the standard compiler. - (#.Cons (: (Tree ($ |0)) + (#.Cons (: (Tree ($ 0)) (//.tree [value {}])) side) ## (#.Cons (//.tree [value {}]) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 2eb8bd35f..e070ced40 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -8,7 +8,7 @@ [type abstract]]) -(def: rgb Nat |256) +(def: rgb Nat 256) (def: top Nat (dec rgb)) (def: rgb-factor Frac (|> top .int int-to-frac)) @@ -155,9 +155,9 @@ t (|> +1.0 (f/- (|> +1.0 (f/- f) (f/* saturation))) (f/* brightness)) v brightness mod (|> i (f/% +6.0) frac-to-int .nat) - red (case mod |0 v |1 q |2 p |3 p |4 t |5 v _ (undefined)) - green (case mod |0 t |1 v |2 v |3 q |4 p |5 p _ (undefined)) - blue (case mod |0 p |1 p |2 t |3 v |4 v |5 q _ (undefined))] + red (case mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined)) + green (case mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined)) + blue (case mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))] (color [(scale-up red) (scale-up green) (scale-up blue)]))) @@ -180,7 +180,7 @@ (def: #export (from-cmyk [cyan magenta yellow key]) (-> [Frac Frac Frac Frac] Color) (if (f/= +1.0 key) - (color [|0 |0 |0]) + (color [0 0 0]) (let [red (|> (|> +1.0 (f/- cyan)) (f/* (|> +1.0 (f/- key)))) green (|> (|> +1.0 (f/- magenta)) @@ -216,7 +216,7 @@ (interpolate' greenE greenS) (interpolate' blueE blueS)]))) -(def: black Color (color [|0 |0 |0])) +(def: black Color (color [0 0 0])) (def: white Color (color [top top top])) (do-template [ ] @@ -283,7 +283,7 @@ (def: #export (analogous results slice color) (-> Nat Frac Color (List Color)) - (if (n/= |0 results) + (if (n/= 0 results) (list) (let [[hue saturation luminance] (to-hsl color) slice (normalize slice)] @@ -291,15 +291,15 @@ (from-hsl [(|> idx .int int-to-frac (f/* slice) (f/+ hue) normalize) saturation luminance])) - (list.n/range |0 (dec results)))))) + (list.n/range 0 (dec results)))))) (def: #export (monochromatic results color) (-> Nat Color (List Color)) - (if (n/= |0 results) + (if (n/= 0 results) (list) (let [[hue saturation brightness] (to-hsb color) slice (|> +1.0 (f// (|> results .int int-to-frac)))] - (|> (list.n/range |0 (dec results)) + (|> (list.n/range 0 (dec results)) (list/map (|>> .int int-to-frac (f/* slice) (f/+ brightness) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index c5c7cbb89..4657b48d5 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -28,10 +28,10 @@ (type: #export Size Nat) -(def: #export size/8 |1) -(def: #export size/16 |2) -(def: #export size/32 |4) -(def: #export size/64 |8) +(def: #export size/8 1) +(def: #export size/16 2) +(def: #export size/32 4) +(def: #export size/64 8) (type: #export Read (p.Parser [Offset Binary])) @@ -46,7 +46,7 @@ ## Operators (def: #export (read format input) (All [a] (-> (Format a) Binary (Error a))) - (case ((get@ #read format) [|0 input]) + (case ((get@ #read format) [0 input]) (#error.Error msg) (#error.Error msg) @@ -59,7 +59,7 @@ (def: #export (write format value) (All [a] (-> (Format a) a Binary)) (let [[valueS valueT] ((get@ #write format) value)] - (|> valueS binary.create (valueT |0)))) + (|> valueS binary.create (valueT 0)))) ## Primitives (do-template [ ] @@ -91,9 +91,9 @@ {#read (do p.Monad [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 [ ] (#error.Success [(inc offset) binary] )) - ([|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 [_ (binary.write/64 offset size binary)] - (binary.copy size |0 value (n/+ size/64 offset) binary))))]))}) + (binary.copy size 0 value (n/+ size/64 offset) binary))))]))}) (def: #export text (Format Text) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 573e422d6..13ffe71da 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -51,8 +51,8 @@ (def: abs id) (def: (signum x) (case x - |0 |0 - _ |1)) + 0 0 + _ 1)) ) (do-template [ <+> <-> <*> <%> <=> <<> <0> <1> <-1>] @@ -107,10 +107,10 @@ (def: top ) (def: bottom ))] - [ Nat Enum (:coerce Nat -1) |0] + [ Nat Enum (:coerce Nat -1) 0] [ Int Enum +9_223_372_036_854_775_807 -9_223_372_036_854_775_808] [Frac Enum ("lux frac max") ("lux frac min")] - [ Rev Enum (:coerce Rev -1) (:coerce Rev |0)] + [ Rev Enum (:coerce Rev -1) (:coerce Rev 0)] ) (do-template [ ] @@ -118,8 +118,8 @@ (def: identity ) (def: compose ))] - [ Add@Monoid Nat |0 n/+] - [ Mul@Monoid Nat |1 n/*] + [ Add@Monoid Nat 0 n/+] + [ Mul@Monoid Nat 1 n/*] [ Max@Monoid Nat (:: Interval bottom) n/max] [ Min@Monoid Nat (:: Interval top) n/min] [ Add@Monoid Int +0 i/+] @@ -182,113 +182,113 @@ (def: (binary-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") + 0 (#.Some "0") + 1 (#.Some "1") _ #.None)) (def: (binary-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) + "0" (#.Some 0) + "1" (#.Some 1) _ #.None)) (def: (octal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") _ #.None)) (def: (octal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) _ #.None)) (def: (decimal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") - |8 (#.Some "8") - |9 (#.Some "9") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") + 8 (#.Some "8") + 9 (#.Some "9") _ #.None)) (def: (decimal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) - "8" (#.Some |8) - "9" (#.Some |9) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) + "8" (#.Some 8) + "9" (#.Some 9) _ #.None)) (def: (hexadecimal-character value) (-> Nat (Maybe Text)) (case value - |0 (#.Some "0") - |1 (#.Some "1") - |2 (#.Some "2") - |3 (#.Some "3") - |4 (#.Some "4") - |5 (#.Some "5") - |6 (#.Some "6") - |7 (#.Some "7") - |8 (#.Some "8") - |9 (#.Some "9") - |10 (#.Some "A") - |11 (#.Some "B") - |12 (#.Some "C") - |13 (#.Some "D") - |14 (#.Some "E") - |15 (#.Some "F") + 0 (#.Some "0") + 1 (#.Some "1") + 2 (#.Some "2") + 3 (#.Some "3") + 4 (#.Some "4") + 5 (#.Some "5") + 6 (#.Some "6") + 7 (#.Some "7") + 8 (#.Some "8") + 9 (#.Some "9") + 10 (#.Some "A") + 11 (#.Some "B") + 12 (#.Some "C") + 13 (#.Some "D") + 14 (#.Some "E") + 15 (#.Some "F") _ #.None)) (def: (hexadecimal-value digit) (-> Text (Maybe Nat)) (case digit - "0" (#.Some |0) - "1" (#.Some |1) - "2" (#.Some |2) - "3" (#.Some |3) - "4" (#.Some |4) - "5" (#.Some |5) - "6" (#.Some |6) - "7" (#.Some |7) - "8" (#.Some |8) - "9" (#.Some |9) - (^or "a" "A") (#.Some |10) - (^or "b" "B") (#.Some |11) - (^or "c" "C") (#.Some |12) - (^or "d" "D") (#.Some |13) - (^or "e" "E") (#.Some |14) - (^or "f" "F") (#.Some |15) + "0" (#.Some 0) + "1" (#.Some 1) + "2" (#.Some 2) + "3" (#.Some 3) + "4" (#.Some 4) + "5" (#.Some 5) + "6" (#.Some 6) + "7" (#.Some 7) + "8" (#.Some 8) + "9" (#.Some 9) + (^or "a" "A") (#.Some 10) + (^or "b" "B") (#.Some 11) + (^or "c" "C") (#.Some 12) + (^or "d" "D") (#.Some 13) + (^or "e" "E") (#.Some 14) + (^or "f" "F") (#.Some 15) _ #.None)) (do-template [ ] @@ -299,36 +299,31 @@ (let [digit (maybe.assume ( (n/% input))) output' ("lux text concat" digit output) input' (n// 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 ( digit) - #.None - (#error.Error ("lux text concat" repr)) - - (#.Some digit-value) - (recur (inc idx) - (|> output (n/* ) (n/+ digit-value))))) - (#error.Success output))) - - _ - (#error.Error ("lux text concat" repr))) + (if (n/> 0 input-size) + (loop [idx 0 + output 0] + (if (n/< input-size idx) + (let [digit (maybe.assume (get-char repr idx))] + (case ( digit) + #.None + (#error.Error ("lux text concat" repr)) + + (#.Some digit-value) + (recur (inc idx) + (|> output (n/* ) (n/+ digit-value))))) + (#error.Success output))) (#error.Error ("lux text concat" repr))))))] - [Binary@Codec |2 binary-character binary-value "Invalid binary syntax for Nat: "] - [Octal@Codec |8 octal-character octal-value "Invalid octal syntax for Nat: "] - [_ |10 decimal-character decimal-value "Invalid syntax for Nat: "] - [Hex@Codec |16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Nat: "] + [Binary@Codec 2 binary-character binary-value "Invalid binary syntax for Nat: "] + [Octal@Codec 8 octal-character octal-value "Invalid octal syntax for Nat: "] + [_ 10 decimal-character decimal-value "Invalid syntax for Nat: "] + [Hex@Codec 16 hexadecimal-character hexadecimal-value "Invalid hexadecimal syntax for Nat: "] ) (def: (int/sign!! value) @@ -339,7 +334,7 @@ (def: (int/sign?? representation) (-> Text (Maybe Int)) - (case (get-char representation |0) + (case (get-char representation 0) (^ (#.Some "-")) (#.Some -1) @@ -351,7 +346,7 @@ (def: (int-decode-loop input-size repr sign ) (-> Nat Text Int Int (-> Text (Maybe Nat)) Text (Error Int)) - (loop [idx |1 + (loop [idx 1 output +0] (if (n/< input-size idx) (let [digit (maybe.assume (get-char repr idx))] @@ -381,7 +376,7 @@ (def: (decode repr) (let [input-size ("lux text size" repr)] - (if (n/> |1 input-size) + (if (n/> 1 input-size) (case (int/sign?? repr) (#.Some sign) (int-decode-loop input-size repr sign ) @@ -398,17 +393,17 @@ (def: (de-prefix input) (-> Text Text) - (maybe.assume ("lux text clip" input |1 ("lux text size" input)))) + (maybe.assume ("lux text clip" input 1 ("lux text size" input)))) (do-template [ ] [(structure: #export (Codec Text Rev) (def: (encode value) (let [raw-output (de-prefix (:: encode (:coerce Nat value))) - max-num-chars (n// |64) + max-num-chars (n// 64) raw-size ("lux text size" raw-output) zero-padding (loop [zeroes-left (n/- raw-size max-num-chars) output ""] - (if (n/= |0 zeroes-left) + (if (n/= 0 zeroes-left) output (recur (dec zeroes-left) ("lux text concat" "0" output)))) @@ -417,10 +412,10 @@ (def: (decode repr) (let [repr-size ("lux text size" repr)] - (if (n/>= |2 repr-size) - (case ("lux text char" repr |0) + (if (n/>= 2 repr-size) + (case ("lux text char" repr 0) (^multi (^ (#.Some (char "."))) - [(:: decode ("lux text concat" "|" (de-prefix repr))) + [(:: decode (de-prefix repr)) (#error.Success output)]) (#error.Success (:coerce Rev output)) @@ -428,9 +423,9 @@ (#error.Error ("lux text concat" repr))) (#error.Error ("lux text concat" repr))))))] - [Binary@Codec Binary@Codec |1 "Invalid binary syntax: "] - [Octal@Codec Octal@Codec |3 "Invalid octal syntax: "] - [Hex@Codec Hex@Codec |4 "Invalid hexadecimal syntax: "] + [Binary@Codec Binary@Codec 1 "Invalid binary syntax: "] + [Octal@Codec Octal@Codec 3 "Invalid octal syntax: "] + [Hex@Codec Hex@Codec 4 "Invalid hexadecimal syntax: "] ) (do-template [ ] @@ -453,9 +448,9 @@ ("lux text concat" whole-part decimal-part))) (def: (decode repr) - (case ("lux text index" repr "." |0) + (case ("lux text index" repr "." 0) (#.Some split-index) - (let [whole-part (maybe.assume ("lux text clip" repr |0 split-index)) + (let [whole-part (maybe.assume ("lux text clip" repr 0 split-index)) decimal-part (maybe.assume ("lux text clip" repr (inc split-index) ("lux text size" repr)))] (case [(:: decode whole-part) (:: decode decimal-part)] @@ -466,7 +461,7 @@ +1.0) div-power (loop [muls-left ("lux text size" decimal-part) output +1.0] - (if (n/= |0 muls-left) + (if (n/= 0 muls-left) output (recur (dec muls-left) (f/* output)))) @@ -501,7 +496,7 @@ (list digits) (let [boundary (n/- chunk-size num-digits) chunk (maybe.assume ("lux text clip" digits boundary num-digits)) - remaining (maybe.assume ("lux text clip" digits |0 boundary))] + remaining (maybe.assume ("lux text clip" digits 0 boundary))] (list& chunk (segment-digits chunk-size remaining))))))) (def: (bin-segment-to-hex input) @@ -593,15 +588,15 @@ (do-template [ ] [(def: ( on-left? input) (-> Bit Text Text) - (let [max-num-chars (n// |64) + (let [max-num-chars (n// 64) input-size ("lux text size" input) zero-padding (let [num-digits-that-need-padding (n/% 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 ) output ""] - (if (n/= |0 zeroes-left) + (if (n/= 0 zeroes-left) output (recur (dec zeroes-left) ("lux text concat" "0" output)))))) @@ -615,12 +610,12 @@ (def: (-> Text Text) - (|>> (segment-digits |1) + (|>> (segment-digits 1) (map ) 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 [ ] @@ -628,9 +623,9 @@ (def: (encode value) (let [sign (:: Number signum value) raw-bin (:: Binary@Codec 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 (|> ( #0 decimal-part) @@ -640,15 +635,15 @@ hex-output)) (def: (decode repr) - (let [sign (case ("lux text index" repr "-" |0) - (#.Some |0) + (let [sign (case ("lux text index" repr "-" 0) + (#.Some 0) -1.0 _ +1.0)] - (case ("lux text index" repr "." |0) + (case ("lux text index" repr "." 0) (#.Some split-index) - (let [whole-part (maybe.assume ("lux text clip" repr (if (f/= -1.0 sign) |1 |0) split-index)) + (let [whole-part (maybe.assume ("lux text clip" repr (if (f/= -1.0 sign) 1 0) split-index)) decimal-part (maybe.assume ("lux text clip" repr (inc split-index) ("lux text size" repr))) as-binary (|> ( decimal-part) ("lux text concat" ".") @@ -688,8 +683,8 @@ (def: (underscore-prefixed? number) (-> Text Bit) - (case ("lux text index" number "_" |0) - (#.Some |0) + (case ("lux text index" number "_" 0) + (#.Some 0) #1 _ @@ -758,7 +753,7 @@ (def: (digits-get idx digits) (-> Nat Digits Nat) - (maybe.default |0 ("lux array get" digits idx))) + (maybe.default 0 ("lux array get" digits idx))) (def: (digits-put idx digit digits) (-> Nat Nat Digits Digits) @@ -771,22 +766,22 @@ (def: (digits-times-5! idx output) (-> Nat Digits Digits) (loop [idx idx - carry |0 + carry 0 output output] (if (i/>= +0 (:coerce Int idx)) (let [raw (|> (digits-get idx output) - (n/* |5) + (n/* 5) (n/+ carry))] (recur (dec idx) - (n// |10 raw) - (digits-put idx (n/% |10 raw) output))) + (n// 10 raw) + (digits-put idx (n/% 10 raw) output))) output))) (def: (digits-power power) (-> Nat Digits) (loop [times power output (|> (make-digits []) - (digits-put power |1))] + (digits-put power 1))] (if (i/>= +0 (:coerce Int times)) (recur (dec times) (digits-times-5! power output)) @@ -799,7 +794,7 @@ output ""] (if (i/>= +0 (:coerce Int idx)) (let [digit (digits-get idx digits)] - (if (and (n/= |0 digit) + (if (and (n/= 0 digit) all-zeroes?) (recur (dec idx) #1 output) (recur (dec idx) @@ -814,7 +809,7 @@ (def: (digits-add param subject) (-> Digits Digits Digits) (loop [idx (dec i64.width) - carry |0 + carry 0 output (make-digits [])] (if (i/>= +0 (:coerce Int idx)) (let [raw ($_ n/+ @@ -822,19 +817,19 @@ (digits-get idx param) (digits-get idx subject))] (recur (dec idx) - (n// |10 raw) - (digits-put idx (n/% |10 raw) output))) + (n// 10 raw) + (digits-put idx (n/% 10 raw) output))) output))) (def: (text-to-digits input) (-> Text (Maybe Digits)) (let [length ("lux text size" input)] (if (n/<= i64.width length) - (loop [idx |0 + (loop [idx 0 output (make-digits [])] (if (n/< length idx) (let [char (maybe.assume (get-char input idx))] - (case ("lux text index" "+0123456789" char |0) + (case ("lux text index" "+0123456789" char 0) #.None #.None @@ -846,7 +841,7 @@ (def: (digits-lt param subject) (-> Digits Digits Bit) - (loop [idx |0] + (loop [idx 0] (and (n/< i64.width idx) (let [pd (digits-get idx param) sd (digits-get idx subject)] @@ -860,11 +855,11 @@ (if (n/>= param sd) (digits-put idx (n/- param sd) subject) (let [diff (|> sd - (n/+ |10) + (n/+ 10) (n/- param))] (|> subject (digits-put idx diff) - (digits-sub-once! (dec idx) |1)))))) + (digits-sub-once! (dec idx) 1)))))) (def: (digits-sub! param subject) (-> Digits Digits Digits) @@ -879,7 +874,7 @@ (def: (encode input) (let [input (:coerce Nat input) last-idx (dec i64.width)] - (if (n/= |0 input) + (if (n/= 0 input) ".0" (loop [idx last-idx digits (make-digits [])] @@ -896,21 +891,21 @@ (def: (decode input) (let [length ("lux text size" input) - dotted? (case ("lux text index" input "." |0) - (#.Some |0) + dotted? (case ("lux text index" input "." 0) + (#.Some 0) #1 _ #0)] (if (and dotted? (n/<= (inc i64.width) length)) - (case (|> ("lux text clip" input |1 length) + (case (|> ("lux text clip" input 1 length) maybe.assume text-to-digits) (#.Some digits) (loop [digits digits - idx |0 - output |0] + idx 0 + output 0] (if (n/< i64.width idx) (let [power (digits-power idx)] (if (digits-lt power digits) @@ -931,58 +926,58 @@ (f// ("lux math log" +2.0) ("lux math log" input))) -(def: double-bias Nat |1023) +(def: double-bias Nat 1023) -(def: mantissa-size Nat |52) -(def: exponent-size Nat |11) +(def: mantissa-size Nat 52) +(def: exponent-size Nat 11) (def: #export (frac-to-bits input) (-> Frac I64) (i64 (cond (not-a-number? input) - (hex "|7FF7FFFFFFFFFFFF") + (hex "7FF7FFFFFFFFFFFF") (f/= positive-infinity input) - (hex "|7FF0000000000000") + (hex "7FF0000000000000") (f/= negative-infinity input) - (hex "|FFF0000000000000") + (hex "FFF0000000000000") (f/= +0.0 input) (let [reciprocal (f// input +1.0)] (if (f/= positive-infinity reciprocal) ## Positive zero - (hex "|0000000000000000") + (hex "0000000000000000") ## Negative zero - (hex "|8000000000000000"))) + (hex "8000000000000000"))) ## else (let [sign (:: Number signum input) input (:: Number abs input) exponent ("lux math floor" (log2 input)) - exponent-mask (|> |1 (i64.left-shift exponent-size) dec) + exponent-mask (|> 1 (i64.left-shift exponent-size) dec) mantissa (|> input ## Normalize (f// ("lux math pow" +2.0 exponent)) ## Make it int-equivalent (f/* ("lux math pow" +2.0 +52.0))) - sign-bit (if (f/= -1.0 sign) |1 |0) + sign-bit (if (f/= -1.0 sign) 1 0) exponent-bits (|> exponent frac-to-int .nat (n/+ double-bias) (i64.and exponent-mask)) mantissa-bits (|> mantissa frac-to-int .nat)] ($_ i64.or - (i64.left-shift |63 sign-bit) + (i64.left-shift 63 sign-bit) (i64.left-shift mantissa-size exponent-bits) (i64.clear mantissa-size mantissa-bits))) ))) (do-template [ ] - [(def: (|> |1 (i64.left-shift ) dec (i64.left-shift ))) + [(def: (|> 1 (i64.left-shift ) dec (i64.left-shift ))) (def: ( input) (-> (I64 Any) I64) (|> input (i64.and ) (i64.logical-right-shift ) i64))] - [mantissa mantissa-mask mantissa-size |0] + [mantissa mantissa-mask mantissa-size 0] [exponent exponent-mask exponent-size mantissa-size] - [sign sign-mask |1 (n/+ exponent-size mantissa-size)] + [sign sign-mask 1 (n/+ exponent-size mantissa-size)] ) (def: #export (bits-to-frac input) @@ -990,15 +985,15 @@ (let [S (sign input) E (exponent input) M (mantissa input)] - (cond (n/= (hex "|7FF") E) - (if (n/= |0 M) - (if (n/= |0 S) + (cond (n/= (hex "7FF") E) + (if (n/= 0 M) + (if (n/= 0 S) positive-infinity negative-infinity) not-a-number) - (and (n/= |0 E) (n/= |0 M)) - (if (n/= |0 S) + (and (n/= 0 E) (n/= 0 M)) + (if (n/= 0 S) +0.0 (f/* -1.0 +0.0)) @@ -1011,7 +1006,7 @@ ("lux math pow" +2.0)) shifted (f/* power normalized)] - (if (n/= |0 S) + (if (n/= 0 S) shifted (f/* -1.0 shifted)))))) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index fb0401582..cd785fb31 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -291,13 +291,13 @@ (def: #export (roots nth input) (-> Nat Complex (List Complex)) - (if (n/= |0 nth) + (if (n/= 0 nth) (list) (let [r-nth (|> nth .int int-to-frac) nth-root-of-abs (|> input abs (get@ #real) (math.pow (f// r-nth +1.0))) nth-phi (|> input argument (f// r-nth)) slice (|> math.pi (f/* +2.0) (f// r-nth))] - (|> (list.n/range |0 (dec nth)) + (|> (list.n/range 0 (dec nth)) (list/map (function (_ nth') (let [inner (|> nth' .int int-to-frac (f/* slice) diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 9d1e8794b..aba61ad3e 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -1,6 +1,6 @@ (.module: [lux (#- and or not)]) -(def: #export width Nat |64) +(def: #export width Nat 64) ## [Values] (do-template [ ] @@ -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 [
] [(def: #export ( distance input) @@ -84,4 +84,4 @@ (def: #export (region size offset) (-> Nat Nat I64) - (|> |1 (:coerce I64) (left-shift size) dec (left-shift offset))) + (|> 1 (:coerce I64) (left-shift size) dec (left-shift offset))) diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index b072a808a..647eaf4b5 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -123,18 +123,14 @@ #denominator numerator}) (def: abs id) (def: (signum x) - {#numerator |1 - #denominator |1})) + {#numerator 1 + #denominator 1})) (def: separator Text ":") (def: part-encode (-> Nat Text) - (|>> nat/encode (text.split |1) maybe.assume product.right)) - -(def: part-decode - (-> Text (E.Error Nat)) - (|>> (format "+") nat/decode)) + (|>> nat/encode (text.split 1) maybe.assume product.right)) (structure: #export _ (Codec Text Ratio) (def: (encode (^slots [#numerator #denominator])) @@ -144,8 +140,8 @@ (case (text.split-with separator input) (#.Some [num denom]) (do E.Monad - [numerator (part-decode num) - denominator (part-decode denom)] + [numerator (nat/decode num) + denominator (nat/decode denom)] (wrap (normalize {#numerator numerator #denominator denominator}))) @@ -158,5 +154,5 @@ "The denominator can be omitted if it's 1." (ratio numerator))} (wrap (list (` ((~! normalize) {#..numerator (~ numerator) - #..denominator (~ (maybe.default (' |1) + #..denominator (~ (maybe.default (' 1) ?denominator))}))))) diff --git a/stdlib/source/lux/data/sum.lux b/stdlib/source/lux/data/sum.lux index 24704c3c0..edb9d19fd 100644 --- a/stdlib/source/lux/data/sum.lux +++ b/stdlib/source/lux/data/sum.lux @@ -7,8 +7,8 @@ (All [a b] (-> (| a b))) ( 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 [ ] [(def: #export ( es) @@ -36,8 +36,8 @@ (#.Cons ( x) es') (#.Cons [x ( es')]) (#.Cons _ es') ( es')))] - [lefts a |0] - [rights b |1] + [lefts a 0] + [rights b 1] ) (def: #export (partition xs) @@ -49,5 +49,5 @@ (#.Cons x xs') (let [[lefts rights] (partition xs')] (case x - (|0 x') [(#.Cons x' lefts) rights] - (|1 x') [lefts (#.Cons x' rights)])))) + (0 x') [(#.Cons x' lefts) rights] + (1 x') [lefts (#.Cons x' rights)])))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index f5462e4e7..48f35febe 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -30,7 +30,7 @@ (def: #export (index-of pattern input) (-> Text Text (Maybe Nat)) - ("lux text index" input pattern |0)) + ("lux text index" input pattern 0)) (def: (last-index-of'' part since text) (-> Text Nat Text (Maybe Nat)) @@ -52,7 +52,7 @@ (def: #export (last-index-of part text) (-> Text Text (Maybe Nat)) - (case ("lux text index" text part |0) + (case ("lux text index" text part 0) (#.Some since) (last-index-of'' part since text) @@ -62,7 +62,7 @@ (def: #export (starts-with? prefix x) (-> Text Text Bit) (case (index-of prefix x) - (#.Some |0) + (#.Some 0) #1 _ @@ -80,7 +80,7 @@ (def: #export (contains? sub text) (-> Text Text Bit) - (case ("lux text index" text sub |0) + (case ("lux text index" text sub 0) (#.Some _) #1 @@ -97,7 +97,7 @@ (def: #export (split at x) (-> Nat Text (Maybe [Text Text])) - (case [(..clip |0 at x) (..clip' at x)] + (case [(..clip 0 at x) (..clip' at x)] [(#.Some pre) (#.Some post)] (#.Some [pre post]) @@ -179,13 +179,13 @@ (:coerce Nat))} ## Platform-independent default. (let [length ("lux text size" input)] - (loop [idx |0 - hash |0] + (loop [idx 0 + hash 0] (if (n/< length idx) - (let [char (|> idx ("lux text char" input) (maybe.default |0))] + (let [char (|> idx ("lux text char" input) (maybe.default 0))] (recur (inc idx) (|> hash - (i64.left-shift |5) + (i64.left-shift 5) (n/- hash) (n/+ char)))) hash))))))) diff --git a/stdlib/source/lux/data/text/buffer.lux b/stdlib/source/lux/data/text/buffer.lux index af9d14efc..38b47e875 100644 --- a/stdlib/source/lux/data/text/buffer.lux +++ b/stdlib/source/lux/data/text/buffer.lux @@ -34,7 +34,7 @@ (def: #export empty Buffer (:abstraction (for {(~~ (static _.jvm)) - [|0 id]} + [0 id]} ## default row.empty))) @@ -59,7 +59,7 @@ ## default (row/fold (function (_ chunk total) (n/+ (//.size chunk) total)) - |0 + 0 (:representation buffer)))) (def: #export (text buffer) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 14afb4254..481d17b0a 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -15,7 +15,7 @@ (type: Offset Nat) -(def: start-offset Offset |0) +(def: start-offset Offset 0) (type: #export Lexer (p.Parser [Offset Text])) @@ -126,7 +126,7 @@ (-> Nat Nat (Lexer Text)) (do p.Monad [char any - #let [char' (maybe.assume (text.nth |0 char))] + #let [char' (maybe.assume (text.nth 0 char))] _ (p.assert ($_ text/compose "Character is not within range: " (text.from-code bottom) "-" (text.from-code top)) (.and (n/>= bottom char') (n/<= top char')))] diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 658d51ae2..ffd937d8e 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -81,9 +81,9 @@ (def: re-range^ (l.Lexer Code) (do p.Monad - [from (|> regex-char^ (:: @ map (|>> (text.nth |0) maybe.assume))) + [from (|> regex-char^ (:: @ map (|>> (text.nth 0) maybe.assume))) _ (l.this "-") - to (|> regex-char^ (:: @ map (|>> (text.nth |0) maybe.assume)))] + to (|> regex-char^ (:: @ map (|>> (text.nth 0) maybe.assume)))] (wrap (` (l.range (~ (code.nat from)) (~ (code.nat to))))))) (def: re-char^ @@ -288,7 +288,7 @@ #.None [(inc idx) (code.identifier ["" (int/encode idx)])]) - access (if (n/> |0 num-captures) + access (if (n/> 0 num-captures) (` ((~! product.left) (~ name!))) name!)] [idx! @@ -303,7 +303,7 @@ parts)]] (wrap [(if capturing? (list.size names) - |0) + 0) (` (do p.Monad [(~ (' #let)) [(~ g!total) ""] (~+ (|> steps list.reverse list/join))] @@ -319,12 +319,12 @@ (function (_ input) (case (left input) (#e.Success [input' [lt lv]]) - (#e.Success [input' [lt (|0 lv)]]) + (#e.Success [input' [lt (0 lv)]]) (#e.Error _) (case (right input) (#e.Success [input' [rt rv]]) - (#e.Success [input' [rt (|1 rv)]]) + (#e.Success [input' [rt (1 rv)]]) (#e.Error error) (#e.Error error))))) @@ -346,7 +346,7 @@ (def: (prep-alternative [num-captures alt]) (-> [Nat Code] Code) - (if (n/> |0 num-captures) + (if (n/> 0 num-captures) alt (` ((~! unflatten^) (~ alt))))) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 96f16052a..011af390e 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -59,128 +59,128 @@ (do-template [ ] [(def: #export Segment (..segment (hex ) (hex )))] - [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 compose left right)) _ - (let [[sides extra] (n//% |2 (list.size segments)) + (let [[sides extra] (n//% 2 (list.size segments)) [left+ right+] (list.split (n/+ sides extra) segments)] (finger.branch (set left+) (set right+))))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 767a4976f..5b91fc526 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1921,7 +1921,7 @@ {type (generic-type^ imports (list))} size) {#.doc (doc "Create an array of the given type, with the given size." - (array Object |10))} + (array Object 10))} (case type (^template [ ] (^ (#GenericClass (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 @@ -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 diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index ed277b4c3..9295795be 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -21,7 +21,7 @@ "Some value...")))} (case tokens (^ (list value)) - (let [blank (: Code [["" |0 |0] (#.Identifier ["" ""])])] + (let [blank (: Code [["" 0 0] (#.Identifier ["" ""])])] (#.Right [state (list (` ([(~ blank) (~ blank)] (~ value))))])) _ diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 0de1e5772..f04503e2f 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -27,7 +27,7 @@ ## (Ann Cursor (Code' (Ann Cursor)))) ## [Utils] -(def: _cursor Cursor ["" |0 |0]) +(def: _cursor Cursor ["" 0 0]) ## [Functions] (do-template [ ] diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 9be5a2ad4..135cad97e 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -153,7 +153,7 @@ (do p.Monad [headT any] (let [members ( (type.un-name headT))] - (if (n/> |1 (list.size members)) + (if (n/> 1 (list.size members)) (local members poly) (p.fail (ex.construct headT))))))] @@ -166,7 +166,7 @@ (do p.Monad [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 [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 [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 [env ..env [funcT argsT] (apply (p.and any (p.many any))) - _ (local (list funcT) (..parameter! |0)) + _ (local (list funcT) (..parameter! 0)) allC (let [allT (list& funcT argsT)] (|> allT (monad.map @ (function.constant ..parameter)) @@ -425,13 +425,13 @@ (#.Parameter idx) (let [idx (adjusted-idx env idx)] - (if (n/= |0 idx) + (if (n/= 0 idx) (|> (dict.get idx env) maybe.assume product.left (to-code env)) (` (.$ (~ (code.nat (dec idx))))))) (#.Apply (#.Named ["lux" "Nothing"] _) (#.Parameter idx)) (let [idx (adjusted-idx env idx)] - (if (n/= |0 idx) + (if (n/= 0 idx) (|> (dict.get idx env) maybe.assume product.left (to-code env)) (undefined))) diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 6f356c060..af714ed51 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -116,7 +116,7 @@ (do @ [g!eqs (poly.tuple (p.many Equivalence)) #let [g!_ (code.local-identifier "_____________") - indices (|> (list.size g!eqs) dec (list.n/range |0)) + indices (|> (list.size g!eqs) dec (list.n/range 0)) g!lefts (list/map (|>> nat/encode (text/compose "left") code.local-identifier) indices) g!rights (list/map (|>> nat/encode (text/compose "right") code.local-identifier) indices)]] (wrap (` (: (~ (@Equivalence inputT)) diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index 711179404..205e78566 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -29,7 +29,7 @@ #let [num-vars (list.size varsC)] #let [@Functor (: (-> Type Code) (function (_ unwrappedT) - (if (n/= |1 num-vars) + (if (n/= 1 num-vars) (` ((~! functor.Functor) (~ (poly.to-code *env* unwrappedT)))) (let [paramsC (|> num-vars dec list.indices (list/map (|>> %n code.local-identifier)))] (` (All [(~+ paramsC)] @@ -39,7 +39,7 @@ ($_ p.either ## Type-var (do p.Monad - [#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 [pairsCC (: (poly.Poly (List [Code Code])) - (poly.tuple (loop [idx |0 + (poly.tuple (loop [idx 0 pairsCC (: (List [Code Code]) (list))] (p.either (let [slotC (|> idx %n (format "____________slot") code.local-identifier)] @@ -75,7 +75,7 @@ [inT+ outC] (poly.function (p.many poly.any) (Arg outL)) #let [inC+ (|> (list.size inT+) dec - (list.n/range |0) + (list.n/range 0) (list/map (|>> %n (format "____________inC") code.local-identifier)))]] (wrap (` (function ((~ g!) (~+ inC+)) (let [(~ outL) ((~ valueC) (~+ inC+))] diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index b9710773a..9eabdc816 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -44,12 +44,12 @@ (function (_ input) (non-rec (rec-encode non-rec) input))) -(def: low-mask Nat (|> |1 (i64.left-shift |32) dec)) -(def: high-mask Nat (|> low-mask (i64.left-shift |32))) +(def: low-mask Nat (|> 1 (i64.left-shift 32) dec)) +(def: high-mask Nat (|> low-mask (i64.left-shift 32))) (structure: _ (Codec JSON Nat) (def: (encode input) - (let [high (|> input (i64.and high-mask) (i64.logical-right-shift |32)) + (let [high (|> input (i64.and high-mask) (i64.logical-right-shift 32)) low (i64.and low-mask input)] (#//.Array (row (|> high .int int-to-frac #//.Number) (|> low .int int-to-frac #//.Number))))) @@ -59,7 +59,7 @@ (do p.Monad [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//encode)) #let [g!_ (code.local-identifier "_______") g!members (|> (list.size g!encoders) dec - (list.n/range |0) + (list.n/range 0) (list/map (|>> nat/encode code.local-identifier)))]] (wrap (` (: (~ (@JSON//encode inputT)) (function ((~ g!_) [(~+ g!members)]) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 63eedfc9a..cdaf54461 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -88,9 +88,9 @@ (def: #export (factorial n) (-> Nat Nat) - (loop [acc |1 + (loop [acc 1 n n] - (if (n/<= |1 n) + (if (n/<= 1 n) acc (recur (n/* n acc) (dec n))))) @@ -118,7 +118,7 @@ (|> a ( ( a b)) (<*> b)) ))] - [Nat n/mod n/gcd n/lcm |0 n/* n// n/-] + [Nat n/mod n/gcd n/lcm 0 n/* n// n/-] [Int i/mod i/gcd i/lcm +0 i/* i// i/-] ) @@ -251,7 +251,7 @@ (infix [sin [x i/+ y]]) (infix [[x n/< y] and [y n/< z]]) (infix [#and x n/< y n/< z]) - (infix [(n/* |3 |9) gcd |450]) + (infix [(n/* 3 9) gcd 450]) "The rules for infix syntax are simple." "If you want your binary function to work well with it." diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 1fc5c5476..fdbf202cf 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -88,7 +88,7 @@ (Random Bit) (function (_ prng) (let [[prng output] (prng [])] - [prng (|> output (i64.and |1) (n/= |1))]))) + [prng (|> output (i64.and 1) (n/= 1))]))) (def: #export i64 (Random I64) @@ -96,7 +96,7 @@ (let [[prng left] (prng []) [prng right] (prng [])] [prng (|> left - (i64.left-shift |32) + (i64.left-shift 32) ("lux i64 +" right))]))) (def: #export nat @@ -131,7 +131,7 @@ (def: #export (text char-gen size) (-> (Random Char) Nat (Random Text)) - (if (n/= |0 size) + (if (n/= 0 size) (:: Monad wrap "") (do Monad [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 [ ] [(def: #export ( size value-gen) (All [a] (-> Nat (Random a) (Random ( a)))) - (if (n/> |0 size) + (if (n/> 0 size) (do Monad [x value-gen xs ( (dec size) value-gen)] @@ -229,7 +229,7 @@ (def: #export (set Hash size value-gen) (All [a] (-> (Hash a) Nat (Random a) (Random (Set a)))) - (if (n/> |0 size) + (if (n/> 0 size) (do Monad [xs (set Hash (dec size) value-gen)] (loop [_ []] @@ -243,7 +243,7 @@ (def: #export (dictionary Hash 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 [kv (dictionary Hash (dec size) key-gen value-gen)] (loop [_ []] @@ -260,7 +260,7 @@ (All [a] (-> PRNG (Random a) [PRNG a])) (calc prng)) -(def: pcg-32-magic-mult Nat |6364136223846793005) +(def: pcg-32-magic-mult Nat 6364136223846793005) (def: #export (pcg-32 [inc seed]) {#.doc "An implementation of the PCG32 algorithm. @@ -269,11 +269,11 @@ (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(|> seed .nat (n/* pcg-32-magic-mult) ("lux i64 +" inc) [inc] pcg-32) - (let [rot (|> seed .i64 (i64.logical-right-shift |59))] + (let [rot (|> seed .i64 (i64.logical-right-shift 59))] (|> seed - (i64.logical-right-shift |18) + (i64.logical-right-shift 18) (i64.xor seed) - (i64.logical-right-shift |27) + (i64.logical-right-shift 27) (i64.rotate-right rot) .i64))])) @@ -285,10 +285,10 @@ (function (_ _) [(let [s01 (i64.xor s0 s1)] (xoroshiro-128+ [(|> s0 - (i64.rotate-left |55) + (i64.rotate-left 55) (i64.xor s01) - (i64.xor (i64.left-shift |14 s01))) - (i64.rotate-left |36 s01)])) + (i64.xor (i64.left-shift 14 s01))) + (i64.rotate-left 36 s01)])) ("lux i64 +" s0 s1)])) (def: (swap from to vec) @@ -307,7 +307,7 @@ [rand nat] (wrap (swap idx (n/% _size rand) vec)))) row - (list.n/range |0 (dec _size)))] + (list.n/range 0 (dec _size)))] (|> _shuffle - (run (pcg-32 [|123 seed])) + (run (pcg-32 [123 seed])) product.right))) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 3230ca27e..26e99fbce 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -33,12 +33,12 @@ (type: #export Test (r.Random (Promise [Counters Text]))) -(def: pcg-32-magic-inc Nat |12345) +(def: pcg-32-magic-inc Nat 12345) ## [Values] -(def: success Counters [|1 |0]) -(def: failure Counters [|0 |1]) -(def: start Counters [|0 |0]) +(def: success Counters [1 0]) +(def: failure Counters [0 1]) +(def: start Counters [0 0]) (def: (add-counters [s f] [ts tf]) (-> Counters Counters Counters) @@ -87,7 +87,7 @@ (def: failed? (-> Counters Bit) - (|>> product.right (n/> |0))) + (|>> product.right (n/> 0))) (def: #export (seed value test) (-> Seed Test Test) @@ -103,10 +103,10 @@ (def: #export (times amount test) (-> Nat Test Test) - (cond (n/= |0 amount) + (cond (n/= 0 amount) (fail "Cannot try a test 0 times.") - (n/= |1 amount) + (n/= 1 amount) test ## else @@ -167,7 +167,7 @@ "By default, random tests will be tried 100 times, you can specify the amount you want:" (context: "Addition & Substraction" - (<| (times |1234) + (<| (times 1234) (do @ [x (:: @ map rand-gen) y (:: @ map 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 rand-gen) y (:: @ map rand-gen)] @@ -235,8 +235,8 @@ (:: @ map list/join)))] (wrap (list (` (: (~! (IO Any)) ((~! io) (exec ((~! do) (~! promise.Monad) - [(~' #let) [(~ g!total-successes) |0 - (~ g!total-failures) |0] + [(~' #let) [(~ g!total-successes) 0 + (~ g!total-failures) 0] (~+ (|> tests (list/map (function (_ [module-name test desc]) (` [(~ (code.text module-name)) (~ (code.identifier [module-name test])) (~ (code.text desc))]))) @@ -248,7 +248,7 @@ list/join))] (exec (log! ((~! success-message) (~ g!total-successes) (~ g!total-failures))) ((~! promise.future) - ((~! io.exit) (if (n/> |0 (~ g!total-failures)) + ((~! io.exit) (if (n/> 0 (~ g!total-failures)) +1 +0))))) []))))))))) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 688546698..b902b631f 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -57,18 +57,18 @@ (def: (month-to-nat month) (-> Month Nat) (case month - #January |0 - #February |1 - #March |2 - #April |3 - #May |4 - #June |5 - #July |6 - #August |7 - #September |8 - #October |9 - #November |10 - #December |11)) + #January 0 + #February 1 + #March 2 + #April 3 + #May 4 + #June 5 + #July 6 + #August 7 + #September 8 + #October 9 + #November 10 + #December 11)) (structure: #export _ (Order Month) (def: eq Equivalence) @@ -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) @@ -246,7 +246,7 @@ (def: lex-section (l.Lexer Int) - (p.codec number.Codec (l.exactly |2 l.decimal))) + (p.codec number.Codec (l.exactly 2 l.decimal))) (def: (leap-years year) (-> Int Int) @@ -256,14 +256,14 @@ (def: normal-months (Row Nat) - (row |31 |28 |31 - |30 |31 |30 - |31 |31 |30 - |31 |30 |31)) + (row 31 28 31 + 30 31 30 + 31 31 30 + 31 30 31)) (def: leap-year-months (Row Nat) - (row.update [|1] inc normal-months)) + (row.update [1] inc normal-months)) (def: (divisible? factor input) (-> Int Int Bit) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 2119608e9..d6c506218 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -108,14 +108,14 @@ (def: normal-months (Row Nat) - (row |31 |28 |31 - |30 |31 |30 - |31 |31 |30 - |31 |30 |31)) + (row 31 28 31 + 30 31 30 + 31 31 30 + 31 30 31)) (def: leap-year-months (Row Nat) - (row.update [|1] inc normal-months)) + (row.update [1] inc normal-months)) (def: (find-month months time) (-> (Row Nat) duration.Duration [Nat duration.Duration]) @@ -125,14 +125,14 @@ (if (i/= +0 (duration.query month-duration time-left)) [current-month time-left] [(inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)]))) - [|0 time] + [0 time] months) (row/fold (function (_ month-days [current-month time-left]) (let [month-duration (duration.scale (.int month-days) duration.day)] (if (i/= +0 (duration.query month-duration time-left)) [current-month time-left] [(dec current-month) (duration.merge month-duration time-left)]))) - [|11 time] + [11 time] (row.reverse months)))) (def: (pad value) @@ -227,11 +227,11 @@ (def: lex-section (l.Lexer Int) - (p.codec number.Codec (l.exactly |2 l.decimal))) + (p.codec number.Codec (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) (p.after (l.this "."))) (:: p.Monad wrap +0))) @@ -288,7 +288,7 @@ month-days-so-far (|> months row.to-list (list.take (.nat (dec utc-month))) - (list/fold n/+ |0)) + (list/fold n/+ 0)) total-days (|> year-days-so-far (i/+ (.int month-days-so-far)) (i/+ (dec utc-day)))]] diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 851039728..5dd1e905f 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -93,7 +93,7 @@ (do-template [ ] [(def: #export ( type) (-> Type [Nat Type]) - (loop [num-args |0 + (loop [num-args 0 type type] (case type ( env sub-type) @@ -305,7 +305,7 @@ [(def: #export ( size body) (-> Nat Type Type) (case size - |0 body + 0 body _ (|> body ( (dec size)) ( (list)))))] [univ-q #.UnivQ] @@ -333,7 +333,7 @@ (def: #export (array level elem-type) (-> Nat Type Type) (case level - |0 elem-type + 0 elem-type _ (|> elem-type (array (dec level)) (list) (#.Primitive "#Array")))) (syntax: #export (:log! {input (p.or s.identifier diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux index f09b8617b..ce5ce652a 100644 --- a/stdlib/source/lux/type/check.lux +++ b/stdlib/source/lux/type/check.lux @@ -298,8 +298,8 @@ (def: #export fresh-context Type-Context - {#.var-counter |0 - #.ex-counter |0 + {#.var-counter 0 + #.ex-counter 0 #.var-bindings (list) }) @@ -357,7 +357,7 @@ then) (do Monad [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 diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index fad0bfb5d..6f26a01f8 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -65,12 +65,12 @@ (find-member-type idx sig-type')) (#.Product left right) - (if (n/= |0 idx) + (if (n/= 0 idx) (:: check.Monad wrap left) (find-member-type (dec idx) right)) _ - (if (n/= |0 idx) + (if (n/= 0 idx) (:: check.Monad wrap sig-type) (check.fail (format "Cannot find member type " (%n idx) " for " (%type sig-type)))))) @@ -326,10 +326,10 @@ (::: eq.= x y) "(List Nat) equivalence" (::: = - (list.n/range |1 |10) - (list.n/range |1 |10)) + (list.n/range 1 10) + (list.n/range 1 10)) "(Functor List) map" - (::: map inc (list.n/range |0 |9)) + (::: map inc (list.n/range 0 9)) "Caveat emptor: You need to make sure to import the module of any structure you want to use." "Otherwise, this macro will not find it.")} (case args diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index 0912c2482..d3f7b7ab0 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -185,7 +185,7 @@ (do p.Monad [raw s.nat _ (p.assert (ex.construct amount-cannot-be-zero []) - (n/> |0 raw))] + (n/> 0 raw))] (wrap raw))) (do-template [ ] diff --git a/stdlib/source/lux/world/binary.lux b/stdlib/source/lux/world/binary.lux index 0b72af60b..a125b8067 100644 --- a/stdlib/source/lux/world/binary.lux +++ b/stdlib/source/lux/world/binary.lux @@ -30,7 +30,7 @@ (def: byte-mask I64 - (|> |1 (i64.left-shift |8) dec .i64)) + (|> 1 (i64.left-shift 8) dec .i64)) (def: i64 (-> (primitive "java.lang.Byte") I64) @@ -52,34 +52,34 @@ (def: #export (read/16 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |1 idx)) + (if (n/< (host.array-length binary) (n/+ 1 idx)) (#error.Success ($_ i64.or - (i64.left-shift |8 (..i64 (host.array-read idx binary))) - (..i64 (host.array-read (n/+ |1 idx) binary)))) + (i64.left-shift 8 (..i64 (host.array-read idx binary))) + (..i64 (host.array-read (n/+ 1 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (read/32 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |3 idx)) + (if (n/< (host.array-length binary) (n/+ 3 idx)) (#error.Success ($_ i64.or - (i64.left-shift |24 (..i64 (host.array-read idx binary))) - (i64.left-shift |16 (..i64 (host.array-read (n/+ |1 idx) binary))) - (i64.left-shift |8 (..i64 (host.array-read (n/+ |2 idx) binary))) - (..i64 (host.array-read (n/+ |3 idx) binary)))) + (i64.left-shift 24 (..i64 (host.array-read idx binary))) + (i64.left-shift 16 (..i64 (host.array-read (n/+ 1 idx) binary))) + (i64.left-shift 8 (..i64 (host.array-read (n/+ 2 idx) binary))) + (..i64 (host.array-read (n/+ 3 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (read/64 idx binary) (-> Nat Binary (Error I64)) - (if (n/< (host.array-length binary) (n/+ |7 idx)) + (if (n/< (host.array-length binary) (n/+ 7 idx)) (#error.Success ($_ i64.or - (i64.left-shift |56 (..i64 (host.array-read idx binary))) - (i64.left-shift |48 (..i64 (host.array-read (n/+ |1 idx) binary))) - (i64.left-shift |40 (..i64 (host.array-read (n/+ |2 idx) binary))) - (i64.left-shift |32 (..i64 (host.array-read (n/+ |3 idx) binary))) - (i64.left-shift |24 (..i64 (host.array-read (n/+ |4 idx) binary))) - (i64.left-shift |16 (..i64 (host.array-read (n/+ |5 idx) binary))) - (i64.left-shift |8 (..i64 (host.array-read (n/+ |6 idx) binary))) - (..i64 (host.array-read (n/+ |7 idx) binary)))) + (i64.left-shift 56 (..i64 (host.array-read idx binary))) + (i64.left-shift 48 (..i64 (host.array-read (n/+ 1 idx) binary))) + (i64.left-shift 40 (..i64 (host.array-read (n/+ 2 idx) binary))) + (i64.left-shift 32 (..i64 (host.array-read (n/+ 3 idx) binary))) + (i64.left-shift 24 (..i64 (host.array-read (n/+ 4 idx) binary))) + (i64.left-shift 16 (..i64 (host.array-read (n/+ 5 idx) binary))) + (i64.left-shift 8 (..i64 (host.array-read (n/+ 6 idx) binary))) + (..i64 (host.array-read (n/+ 7 idx) binary)))) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/8 idx value binary) @@ -92,36 +92,36 @@ (def: #export (write/16 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |1 idx)) + (if (n/< (host.array-length binary) (n/+ 1 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |1 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 1 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/32 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |3 idx)) + (if (n/< (host.array-length binary) (n/+ 3 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |24 value))) - (host.array-write (n/+ |1 idx) (..byte (i64.logical-right-shift |16 value))) - (host.array-write (n/+ |2 idx) (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |3 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 24 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 16 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 3 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) (def: #export (write/64 idx value binary) (-> Nat (I64 Any) Binary (Error Binary)) - (if (n/< (host.array-length binary) (n/+ |7 idx)) + (if (n/< (host.array-length binary) (n/+ 7 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift |56 value))) - (host.array-write (n/+ |1 idx) (..byte (i64.logical-right-shift |48 value))) - (host.array-write (n/+ |2 idx) (..byte (i64.logical-right-shift |40 value))) - (host.array-write (n/+ |3 idx) (..byte (i64.logical-right-shift |32 value))) - (host.array-write (n/+ |4 idx) (..byte (i64.logical-right-shift |24 value))) - (host.array-write (n/+ |5 idx) (..byte (i64.logical-right-shift |16 value))) - (host.array-write (n/+ |6 idx) (..byte (i64.logical-right-shift |8 value))) - (host.array-write (n/+ |7 idx) (..byte value))) + (host.array-write idx (..byte (i64.logical-right-shift 56 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 48 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 40 value))) + (host.array-write (n/+ 3 idx) (..byte (i64.logical-right-shift 32 value))) + (host.array-write (n/+ 4 idx) (..byte (i64.logical-right-shift 24 value))) + (host.array-write (n/+ 5 idx) (..byte (i64.logical-right-shift 16 value))) + (host.array-write (n/+ 6 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write (n/+ 7 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds (%n idx)))) diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux index 893538657..e8eeb1b1b 100644 --- a/stdlib/source/lux/world/net/udp.jvm.lux +++ b/stdlib/source/lux/world/net/udp.jvm.lux @@ -58,8 +58,8 @@ [addresses (InetAddress::getAllByName [address])] (: (io.IO (e.Error InetAddress)) (case (array.size addresses) - |0 (io.io (ex.throw cannot-resolve-address address)) - |1 (wrap (maybe.assume (array.read |0 addresses))) + 0 (io.io (ex.throw cannot-resolve-address address)) + 1 (wrap (maybe.assume (array.read 0 addresses))) _ (io.io (ex.throw multiple-candidate-addresses address)))))) (abstract: #export UDP {} -- cgit v1.2.3