aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/math/infix.lux20
-rw-r--r--stdlib/source/library/lux/math/logic/continuous.lux6
-rw-r--r--stdlib/source/library/lux/math/modular.lux18
-rw-r--r--stdlib/source/library/lux/math/number.lux8
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux4
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux14
-rw-r--r--stdlib/source/library/lux/math/number/i16.lux8
-rw-r--r--stdlib/source/library/lux/math/number/i32.lux8
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux2
-rw-r--r--stdlib/source/library/lux/math/number/i8.lux8
-rw-r--r--stdlib/source/library/lux/math/number/int.lux16
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux4
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux12
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux44
-rw-r--r--stdlib/source/library/lux/math/random.lux76
15 files changed, 124 insertions, 124 deletions
diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux
index 36dd132d6..1983f9228 100644
--- a/stdlib/source/library/lux/math/infix.lux
+++ b/stdlib/source/library/lux/math/infix.lux
@@ -4,12 +4,12 @@
[abstract
[monad {"+" [do]}]]
[control
- ["<>" parser ("[1]\[0]" functor)
+ ["<>" parser ("[1]#[0]" functor)
["<[0]>" code {"+" [Parser]}]]]
[data
["[0]" product]
[collection
- ["[0]" list ("[1]\[0]" mix)]]]
+ ["[0]" list ("[1]#[0]" mix)]]]
[macro
[syntax {"+" [syntax:]}]
["[0]" code]]
@@ -29,13 +29,13 @@
(def: literal
(Parser Code)
($_ <>.either
- (<>\each code.bit <code>.bit)
- (<>\each code.nat <code>.nat)
- (<>\each code.int <code>.int)
- (<>\each code.rev <code>.rev)
- (<>\each code.frac <code>.frac)
- (<>\each code.text <code>.text)
- (<>\each code.identifier <code>.identifier)))
+ (<>#each code.bit <code>.bit)
+ (<>#each code.nat <code>.nat)
+ (<>#each code.int <code>.int)
+ (<>#each code.rev <code>.rev)
+ (<>#each code.frac <code>.frac)
+ (<>#each code.text <code>.text)
+ (<>#each code.identifier <code>.identifier)))
(def: expression
(Parser Infix)
@@ -49,7 +49,7 @@
init_op <code>.any
init_param expression
steps (<>.some (<>.and <code>.any expression))]
- (in (list\mix (function (_ [op param] [_subject _op _param])
+ (in (list#mix (function (_ [op param] [_subject _op _param])
[{#Binary _subject _op _param} op param])
[init_subject init_op init_param]
steps))))
diff --git a/stdlib/source/library/lux/math/logic/continuous.lux b/stdlib/source/library/lux/math/logic/continuous.lux
index 26d77139c..51a915d43 100644
--- a/stdlib/source/library/lux/math/logic/continuous.lux
+++ b/stdlib/source/library/lux/math/logic/continuous.lux
@@ -6,10 +6,10 @@
[monoid {"+" [Monoid]}]]
[math
[number
- ["/" rev ("[1]\[0]" interval)]]]]])
+ ["/" rev ("[1]#[0]" interval)]]]]])
-(def: .public false Rev /\bottom)
-(def: .public true Rev /\top)
+(def: .public false Rev /#bottom)
+(def: .public true Rev /#top)
(template [<name> <chooser> <monoid> <identity>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 19d08eb66..711281162 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -15,13 +15,13 @@
["<[0]>" code]]]
[data
["[0]" product]
- ["[0]" text ("[1]\[0]" monoid)]]
+ ["[0]" text ("[1]#[0]" monoid)]]
[macro
[syntax {"+" [syntax:]}]
["[0]" code]]
[math
[number
- ["i" int ("[1]\[0]" decimal)]]]
+ ["i" int ("[1]#[0]" decimal)]]]
[type
abstract]]]
["[0]" // "_"
@@ -49,8 +49,8 @@
(exception: .public [%] (incorrect_modulus [modulus (Modulus %)
parsed Int])
(exception.report
- ["Expected" (i\encoded (//.divisor modulus))]
- ["Actual" (i\encoded parsed)]))
+ ["Expected" (i#encoded (//.divisor modulus))]
+ ["Actual" (i#encoded parsed)]))
(def: separator
" mod ")
@@ -65,10 +65,10 @@
(def: (encoded modular)
(let [[_ value] (:representation modular)]
- ($_ text\composite
- (i\encoded value)
+ ($_ text#composite
+ (i#encoded value)
..separator
- (i\encoded (//.divisor expected)))))
+ (i#encoded (//.divisor expected)))))
(def: decoded
(<text>.result
@@ -143,8 +143,8 @@
(exception: .public [r% s%] (moduli_are_not_equal [reference (Modulus r%)
subject (Modulus s%)])
(exception.report
- ["Reference" (i\encoded (//.divisor reference))]
- ["Subject" (i\encoded (//.divisor subject))]))
+ ["Reference" (i#encoded (//.divisor reference))]
+ ["Subject" (i#encoded (//.divisor subject))]))
(def: .public (adapter reference subject)
(All (_ r% s%)
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index b525754f2..81f38d91b 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -36,22 +36,22 @@
(if (..separator_prefixed? repr')
{try.#Failure <error>}
(let [repr (..without_separators repr')]
- (case (\ <nat> decoded repr)
+ (case (# <nat> decoded repr)
{try.#Success value}
{try.#Success [state (list [meta {.#Nat value}])]}
(^multi {try.#Failure _}
- [(\ <int> decoded repr)
+ [(# <int> decoded repr)
{try.#Success value}])
{try.#Success [state (list [meta {.#Int value}])]}
(^multi {try.#Failure _}
- [(\ <rev> decoded repr)
+ [(# <rev> decoded repr)
{try.#Success value}])
{try.#Success [state (list [meta {.#Rev value}])]}
(^multi {try.#Failure _}
- [(\ <frac> decoded repr)
+ [(# <frac> decoded repr)
{try.#Success value}])
{try.#Success [state (list [meta {.#Frac value}])]}
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index e6b447d69..3a785bc9e 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -12,7 +12,7 @@
["<[0]>" code {"+" [Parser]}]]]
[data
[collection
- ["[0]" list ("[1]\[0]" functor)]]]
+ ["[0]" list ("[1]#[0]" functor)]]]
[macro
[syntax {"+" [syntax:]}]
["[0]" code]]
@@ -297,7 +297,7 @@
nth_phi (|> input ..argument (f./ r_nth))
slice (|> math.pi (f.* +2.0) (f./ r_nth))]
(|> (list.indices nth)
- (list\each (function (_ nth')
+ (list#each (function (_ nth')
(let [inner (|> nth' .int int.frac
(f.* slice)
(f.+ nth_phi))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 892274c28..44e09abc9 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -222,7 +222,7 @@
(template [<cast> <hex> <name>]
[(def: <name>
(|> <hex>
- (\ //nat.hex decoded)
+ (# //nat.hex decoded)
try.trusted
<cast>))]
@@ -352,7 +352,7 @@
after_length (//nat.- after_offset ("lux text size" representation))]
exponent (|> representation
("lux text clip" after_offset after_length)
- (\ codec decoded))]
+ (# codec decoded))]
(in [("lux text clip" 0 split_index representation)
(//int.* <factor> (.int exponent))]))])
([+1 (^or [{.#Some split_index} {.#None} {.#None} {.#None}]
@@ -377,9 +377,9 @@
1 "-"
0 "+"
_ (undefined))
- (\ <nat> encoded (.nat mantissa))
+ (# <nat> encoded (.nat mantissa))
".0E"
- (\ <int> encoded exponent))))
+ (# <int> encoded exponent))))
(def: (decoded representation)
(let [negative? (text.starts_with? "-" representation)
@@ -394,16 +394,16 @@
after_length (//nat.- after_offset ("lux text size" mantissa))]
decimal (|> mantissa
("lux text clip" after_offset after_length)
- (\ <nat> decoded))]
+ (# <nat> decoded))]
(in [("lux text clip" 0 split_index mantissa)
decimal]))
{.#None}
{try.#Failure ("lux text concat" <error> representation)})
.let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)]
- mantissa (\ <nat> decoded (case decimal
+ mantissa (# <nat> decoded (case decimal
0 whole
- _ ("lux text concat" whole (\ <nat> encoded decimal))))
+ _ ("lux text concat" whole (# <nat> encoded decimal))))
.let [sign (if negative? 1 0)]]
(in (..of_bits
($_ //i64.or
diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux
index b191de971..9323c14ce 100644
--- a/stdlib/source/library/lux/math/number/i16.lux
+++ b/stdlib/source/library/lux/math/number/i16.lux
@@ -20,7 +20,7 @@
(I64 size)))
-(def: .public equivalence (Equivalence I16) (\ ..sub &equivalence))
-(def: .public width Nat (\ ..sub bits))
-(def: .public i16 (-> I64 I16) (\ ..sub narrow))
-(def: .public i64 (-> I16 I64) (\ ..sub wide))
+(def: .public equivalence (Equivalence I16) (# ..sub &equivalence))
+(def: .public width Nat (# ..sub bits))
+(def: .public i16 (-> I64 I16) (# ..sub narrow))
+(def: .public i64 (-> I16 I64) (# ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux
index 8d0e7e2b3..3f10bf254 100644
--- a/stdlib/source/library/lux/math/number/i32.lux
+++ b/stdlib/source/library/lux/math/number/i32.lux
@@ -20,7 +20,7 @@
(I64 size)))
-(def: .public equivalence (Equivalence I32) (\ ..sub &equivalence))
-(def: .public width Nat (\ ..sub bits))
-(def: .public i32 (-> I64 I32) (\ ..sub narrow))
-(def: .public i64 (-> I32 I64) (\ ..sub wide))
+(def: .public equivalence (Equivalence I32) (# ..sub &equivalence))
+(def: .public width Nat (# ..sub bits))
+(def: .public i32 (-> I64 I32) (# ..sub narrow))
+(def: .public i64 (-> I32 I64) (# ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index cc36ed7c5..ea2e0c4f9 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -159,7 +159,7 @@
(repetitions size "1")
(repetitions size "0")))
- high (try.trusted (\ n.binary decoded pattern))
+ high (try.trusted (# n.binary decoded pattern))
low (..right_rotated size high)]
(function (_ value)
(..or (..right_shifted size (..and high value))
diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux
index 4f6695535..c33aca004 100644
--- a/stdlib/source/library/lux/math/number/i8.lux
+++ b/stdlib/source/library/lux/math/number/i8.lux
@@ -20,7 +20,7 @@
(I64 size)))
-(def: .public equivalence (Equivalence I8) (\ ..sub &equivalence))
-(def: .public width Nat (\ ..sub bits))
-(def: .public i8 (-> I64 I8) (\ ..sub narrow))
-(def: .public i64 (-> I8 I64) (\ ..sub wide))
+(def: .public equivalence (Equivalence I8) (# ..sub &equivalence))
+(def: .public width Nat (# ..sub bits))
+(def: .public i8 (-> I64 I8) (# ..sub narrow))
+(def: .public i64 (-> I8 I64) (# ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index 9c91fa83b..be36680d2 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -196,8 +196,8 @@
[addition ..+ +0]
[multiplication ..* +1]
- [maximum ..max (\ ..interval bottom)]
- [minimum ..min (\ ..interval top)]
+ [maximum ..max (# ..interval bottom)]
+ [minimum ..min (# ..interval top)]
)
(def: -sign "-")
@@ -209,8 +209,8 @@
(def: (encoded value)
(if (..< +0 value)
- (|> value ++ ..opposite .nat ++ (\ <codec> encoded) ("lux text concat" ..-sign))
- (|> value .nat (\ <codec> encoded) ("lux text concat" ..+sign))))
+ (|> value ++ ..opposite .nat ++ (# <codec> encoded) ("lux text concat" ..-sign))
+ (|> value .nat (# <codec> encoded) ("lux text concat" ..+sign))))
(def: (decoded repr)
(let [input_size ("lux text size" repr)]
@@ -219,14 +219,14 @@
(^ (static ..+sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decoded)
- (\ try.functor each .int))
+ (# <codec> decoded)
+ (# try.functor each .int))
(^ (static ..-sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decoded)
- (\ try.functor each (|>> -- .int ..opposite --)))
+ (# <codec> decoded)
+ (# try.functor each (|>> -- .int ..opposite --)))
_
{try.#Failure <error>})
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index 428b8a68e..4eccc7d13 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -177,8 +177,8 @@
[addition ..+ 0]
[multiplication ..* 1]
- [minimum ..min (\ ..interval top)]
- [maximum ..max (\ ..interval bottom)]
+ [minimum ..min (# ..interval top)]
+ [maximum ..max (# ..interval bottom)]
)
(def: (binary_character value)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index b7ef79ccb..cabd33b4b 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -15,12 +15,12 @@
["<[0]>" code {"+" [Parser]}]]]
[data
["[0]" product]
- ["[0]" text ("[1]\[0]" monoid)]]
+ ["[0]" text ("[1]#[0]" monoid)]]
[macro
[syntax {"+" [syntax:]}]
["[0]" code]]]]
[//
- ["n" nat ("[1]\[0]" decimal)]])
+ ["n" nat ("[1]#[0]" decimal)]])
(type: .public Ratio
(Record
@@ -132,19 +132,19 @@
(Codec Text Ratio)
(def: (encoded (^slots [#numerator #denominator]))
- ($_ text\composite (n\encoded #numerator) ..separator (n\encoded #denominator)))
+ ($_ text#composite (n#encoded #numerator) ..separator (n#encoded #denominator)))
(def: (decoded input)
(case (text.split_by ..separator input)
{.#Some [num denom]}
(do try.monad
- [numerator (n\decoded num)
- denominator (n\decoded denom)]
+ [numerator (n#decoded num)
+ denominator (n#decoded denom)]
(in (normal [#numerator numerator
#denominator denominator])))
{.#None}
- {.#Left (text\composite "Invalid syntax for ratio: " input)})))
+ {.#Left (text#composite "Invalid syntax for ratio: " input)})))
(template [<identity> <composite> <name>]
[(implementation: .public <name>
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index 9228d6a65..5acce7f5b 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -212,7 +212,7 @@
[(implementation: .public <name>
(Monoid Rev)
- (def: identity (\ interval <identity>))
+ (def: identity (# interval <identity>))
(def: composite <composite>))]
[addition ..+ bottom]
@@ -230,7 +230,7 @@
(Codec Text Rev)
(def: (encoded value)
- (let [raw_output (\ <codec> encoded (.nat value))
+ (let [raw_output (# <codec> encoded (.nat value))
max_num_chars (//nat.+ (//nat./ <char_bit_size> //i64.width)
(case (//nat.% <char_bit_size> //i64.width)
0 0
@@ -252,7 +252,7 @@
(if (//nat.> 1 repr_size)
(case ("lux text char" 0 repr)
(^ (char "."))
- (case (\ <codec> decoded (..decimals repr))
+ (case (# <codec> decoded (..decimals repr))
{try.#Success output}
{try.#Success (.rev output)}
@@ -291,11 +291,11 @@
(array.read! idx)
(maybe.else 0)))
-(def: digits\put!
+(def: digits#put!
(-> Nat Nat Digits Digits)
array.write!)
-(def: (digits\times_5! idx output)
+(def: (digits#times_5! idx output)
(-> Nat Digits Digits)
(loop [idx idx
carry 0
@@ -307,17 +307,17 @@
(//nat.+ carry))]
(recur (-- idx)
(//nat./ 10 raw)
- (digits\put! idx (//nat.% 10 raw) output))))))
+ (digits#put! idx (//nat.% 10 raw) output))))))
(def: (power_digits power)
(-> Nat Digits)
(loop [times power
output (|> (..digits [])
- (digits\put! power 1))]
+ (digits#put! power 1))]
(if (//int.< +0 (.int times))
output
(recur (-- times)
- (digits\times_5! power output)))))
+ (digits#times_5! power output)))))
(def: (format digits)
(-> Digits Text)
@@ -335,10 +335,10 @@
(recur (-- idx)
false
("lux text concat"
- (\ //nat.decimal encoded digit)
+ (# //nat.decimal encoded digit)
output)))))))
-(def: (digits\+! param subject)
+(def: (digits#+! param subject)
(-> Digits Digits Digits)
(loop [idx (-- //i64.width)
carry 0
@@ -351,7 +351,7 @@
(..digit idx subject))]
(recur (-- idx)
(//nat./ 10 raw)
- (digits\put! idx (//nat.% 10 raw) output))))))
+ (digits#put! idx (//nat.% 10 raw) output))))))
(def: (text_digits input)
(-> Text (Maybe Digits))
@@ -367,10 +367,10 @@
{.#Some digit}
(recur (++ idx)
- (digits\put! idx digit output)))
+ (digits#put! idx digit output)))
{.#Some output})))))
-(def: (digits\< param subject)
+(def: (digits#< param subject)
(-> Digits Digits Bit)
(loop [idx 0]
(and (//nat.< //i64.width idx)
@@ -380,7 +380,7 @@
(recur (++ idx))
(//nat.< pd sd))))))
-(def: (digits\-!' idx param subject)
+(def: (digits#-!' idx param subject)
(-> Nat Nat Digits Digits)
(let [sd (..digit idx subject)]
(if (//nat.< param sd)
@@ -388,18 +388,18 @@
(//nat.+ 10)
(//nat.- param))]
(|> subject
- (digits\put! idx diff)
- (digits\-!' (-- idx) 1)))
- (digits\put! idx (//nat.- param sd) subject))))
+ (digits#put! idx diff)
+ (digits#-!' (-- idx) 1)))
+ (digits#put! idx (//nat.- param sd) subject))))
-(def: (digits\-! param subject)
+(def: (digits#-! param subject)
(-> Digits Digits Digits)
(loop [idx (-- //i64.width)
output subject]
(if (//int.< +0 (.int idx))
output
(recur (-- idx)
- (digits\-!' idx (..digit idx param) output)))))
+ (digits#-!' idx (..digit idx param) output)))))
(implementation: .public decimal
(Codec Text Rev)
@@ -416,7 +416,7 @@
(if (//int.< +0 (.int idx))
("lux text concat" "." (..format digits))
(if (//i64.one? idx input)
- (let [digits' (digits\+! (power_digits (//nat.- idx last_idx))
+ (let [digits' (digits#+! (power_digits (//nat.- idx last_idx))
digits)]
(recur (-- idx)
digits'))
@@ -441,10 +441,10 @@
output 0]
(if (//nat.< //i64.width idx)
(let [power (power_digits idx)]
- (if (digits\< power digits)
+ (if (digits#< power digits)
... Skip power
(recur digits (++ idx) output)
- (recur (digits\-! power digits)
+ (recur (digits#-! power digits)
(++ idx)
(//i64.one (//nat.- idx (-- //i64.width)) output))))
{try.#Success (.rev output)}))
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index 6db4dc53f..47c83ad6c 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -7,11 +7,11 @@
[apply {"+" [Apply]}]
["[0]" monad {"+" [Monad do]}]]
[data
- ["[0]" text {"+" [Char]} ("[1]\[0]" monoid)
+ ["[0]" text {"+" [Char]} ("[1]#[0]" monoid)
["[0]" unicode "_"
["[1]" set]]]
[collection
- ["[0]" list ("[1]\[0]" mix)]
+ ["[0]" list ("[1]#[0]" mix)]
["[0]" array {"+" [Array]}]
["[0]" dictionary {"+" [Dictionary]}]
["[0]" queue {"+" [Queue]}]
@@ -126,7 +126,7 @@
(template [<name> <type> <cast>]
[(def: .public <name>
(Random <type>)
- (\ ..monad each <cast> ..i64))]
+ (# ..monad each <cast> ..i64))]
[nat Nat .nat]
[int Int .int]
@@ -135,13 +135,13 @@
(def: .public frac
(Random Frac)
- (\ ..monad each (|>> .i64 f.of_bits) ..nat))
+ (# ..monad each (|>> .i64 f.of_bits) ..nat))
(def: .public safe_frac
(Random Frac)
(let [mantissa_range (.int (i64.left_shifted 53 1))
mantissa_max (i.frac (-- mantissa_range))]
- (\ ..monad each
+ (# ..monad each
(|>> (i.% mantissa_range)
i.frac
(f./ mantissa_max))
@@ -155,17 +155,17 @@
in_range (: (-> Char Char)
(|>> (n.% size) (n.+ start)))]
(|> ..nat
- (\ ..monad each in_range)
+ (# ..monad each in_range)
(..only (unicode.member? set)))))
(def: .public (text char_gen size)
(-> (Random Char) Nat (Random Text))
(if (n.= 0 size)
- (\ ..monad in "")
+ (# ..monad in "")
(do ..monad
[x char_gen
xs (text char_gen (-- size))]
- (in (text\composite (text.of_char x) xs)))))
+ (in (text#composite (text.of_char x) xs)))))
(template [<name> <set>]
[(def: .public <name>
@@ -243,7 +243,7 @@
[x value_gen
xs (list (-- size) value_gen)]
(in {.#Item x xs}))
- (\ ..monad in (.list))))
+ (# ..monad in (.list))))
(def: .public (row size value_gen)
(All (_ a) (-> Nat (Random a) (Random (Row a))))
@@ -252,7 +252,7 @@
[x value_gen
xs (row (-- size) value_gen)]
(in (row.suffix x xs)))
- (\ ..monad in row.empty)))
+ (# ..monad in row.empty)))
(template [<name> <type> <ctor>]
[(def: .public (<name> size value_gen)
@@ -263,7 +263,7 @@
[array Array array.of_list]
[queue Queue queue.of_list]
- [stack Stack (list\mix stack.top stack.empty)]
+ [stack Stack (list#mix stack.top stack.empty)]
)
(def: .public (set hash size value_gen)
@@ -278,7 +278,7 @@
(if (n.= size (set.size xs+))
(in xs+)
(recur [])))))
- (\ ..monad in (set.empty hash))))
+ (# ..monad in (set.empty hash))))
(def: .public (dictionary hash size key_gen value_gen)
(All (_ k v) (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v))))
@@ -293,50 +293,50 @@
(if (n.= size (dictionary.size kv+))
(in kv+)
(recur [])))))
- (\ ..monad in (dictionary.empty hash))))
+ (# ..monad in (dictionary.empty hash))))
(def: .public instant
(Random Instant)
- (\ ..monad each instant.of_millis ..int))
+ (# ..monad each instant.of_millis ..int))
(def: .public date
(Random Date)
- (\ ..monad each instant.date ..instant))
+ (# ..monad each instant.date ..instant))
(def: .public time
(Random Time)
- (\ ..monad each instant.time ..instant))
+ (# ..monad each instant.time ..instant))
(def: .public duration
(Random Duration)
- (\ ..monad each duration.of_millis ..int))
+ (# ..monad each duration.of_millis ..int))
(def: .public month
(Random Month)
- (let [(^open "\[0]") ..monad]
- (..either (..either (..either (\in {month.#January})
- (..either (\in {month.#February})
- (\in {month.#March})))
- (..either (\in {month.#April})
- (..either (\in {month.#May})
- (\in {month.#June}))))
- (..either (..either (\in {month.#July})
- (..either (\in {month.#August})
- (\in {month.#September})))
- (..either (\in {month.#October})
- (..either (\in {month.#November})
- (\in {month.#December})))))))
+ (let [(^open "_#[0]") ..monad]
+ (..either (..either (..either (_#in {month.#January})
+ (..either (_#in {month.#February})
+ (_#in {month.#March})))
+ (..either (_#in {month.#April})
+ (..either (_#in {month.#May})
+ (_#in {month.#June}))))
+ (..either (..either (_#in {month.#July})
+ (..either (_#in {month.#August})
+ (_#in {month.#September})))
+ (..either (_#in {month.#October})
+ (..either (_#in {month.#November})
+ (_#in {month.#December})))))))
(def: .public day
(Random Day)
- (let [(^open "\[0]") ..monad]
- (..either (..either (\in {day.#Sunday})
- (..either (\in {day.#Monday})
- (\in {day.#Tuesday})))
- (..either (..either (\in {day.#Wednesday})
- (\in {day.#Thursday}))
- (..either (\in {day.#Friday})
- (\in {day.#Saturday}))))))
+ (let [(^open "_#[0]") ..monad]
+ (..either (..either (_#in {day.#Sunday})
+ (..either (_#in {day.#Monday})
+ (_#in {day.#Tuesday})))
+ (..either (..either (_#in {day.#Wednesday})
+ (_#in {day.#Thursday}))
+ (..either (_#in {day.#Friday})
+ (_#in {day.#Saturday}))))))
(def: .public (result prng calc)
(All (_ a) (-> PRNG (Random a) [PRNG a]))