From 1e34eef43c24d1fb05afeccbe55e958b1b088dab Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 6 Jan 2017 19:33:59 -0400 Subject: - Renamed lux/math/random to lux/random. --- stdlib/source/lux/math/random.lux | 307 ----------------------- stdlib/source/lux/random.lux | 307 +++++++++++++++++++++++ stdlib/source/lux/test.lux | 2 +- stdlib/test/test/lux.lux | 2 +- stdlib/test/test/lux/cli.lux | 2 +- stdlib/test/test/lux/codata/cont.lux | 2 +- stdlib/test/test/lux/codata/struct/stream.lux | 2 +- stdlib/test/test/lux/concurrency/atom.lux | 2 +- stdlib/test/test/lux/concurrency/promise.lux | 2 +- stdlib/test/test/lux/concurrency/stm.lux | 2 +- stdlib/test/test/lux/control/effect.lux | 2 +- stdlib/test/test/lux/data/bit.lux | 2 +- stdlib/test/test/lux/data/bool.lux | 2 +- stdlib/test/test/lux/data/char.lux | 2 +- stdlib/test/test/lux/data/error/exception.lux | 2 +- stdlib/test/test/lux/data/format/json.lux | 2 +- stdlib/test/test/lux/data/ident.lux | 2 +- stdlib/test/test/lux/data/number.lux | 2 +- stdlib/test/test/lux/data/struct/array.lux | 2 +- stdlib/test/test/lux/data/struct/dict.lux | 2 +- stdlib/test/test/lux/data/struct/list.lux | 2 +- stdlib/test/test/lux/data/struct/queue.lux | 2 +- stdlib/test/test/lux/data/struct/set.lux | 2 +- stdlib/test/test/lux/data/struct/stack.lux | 2 +- stdlib/test/test/lux/data/struct/tree.lux | 2 +- stdlib/test/test/lux/data/struct/vector.lux | 2 +- stdlib/test/test/lux/data/struct/zipper.lux | 2 +- stdlib/test/test/lux/data/text.lux | 2 +- stdlib/test/test/lux/host.lux | 2 +- stdlib/test/test/lux/lexer.lux | 2 +- stdlib/test/test/lux/macro/ast.lux | 2 +- stdlib/test/test/lux/macro/poly/eq.lux | 2 +- stdlib/test/test/lux/macro/poly/functor.lux | 2 +- stdlib/test/test/lux/macro/poly/text-encoder.lux | 2 +- stdlib/test/test/lux/macro/syntax.lux | 2 +- stdlib/test/test/lux/math.lux | 2 +- stdlib/test/test/lux/math/complex.lux | 2 +- stdlib/test/test/lux/math/ratio.lux | 2 +- stdlib/test/test/lux/math/simple.lux | 2 +- stdlib/test/test/lux/pipe.lux | 2 +- stdlib/test/test/lux/regex.lux | 2 +- stdlib/test/test/lux/type.lux | 2 +- stdlib/test/test/lux/type/auto.lux | 2 +- stdlib/test/test/lux/type/check.lux | 2 +- 44 files changed, 349 insertions(+), 349 deletions(-) delete mode 100644 stdlib/source/lux/math/random.lux create mode 100644 stdlib/source/lux/random.lux diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux deleted file mode 100644 index 802dbfae6..000000000 --- a/stdlib/source/lux/math/random.lux +++ /dev/null @@ -1,307 +0,0 @@ -## Copyright (c) Eduardo Julian. All rights reserved. -## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -## If a copy of the MPL was not distributed with this file, -## You can obtain one at http://mozilla.org/MPL/2.0/. - -(;module: {#;doc "Pseudo-random number generation (PRNG) algorithms."} - [lux #- list] - (lux (control functor - applicative - monad - hash) - (data [bit] - [char] - [text "Text/" Monoid] - text/format - [product] - [number] - (struct [list "List/" Fold] - ["A" array] - ["D" dict] - ["Q" queue] - ["S" set] - ["ST" stack] - ["V" vector])) - (math ["r" ratio] - ["c" complex]))) - -## [Exports] -(type: #export #rec PRNG - {#;doc "An abstract way to represent any PRNG."} - (-> Unit [PRNG Nat])) - -(type: #export (Random a) - {#;doc "A producer of random values based on a PRNG."} - (-> PRNG [PRNG a])) - -(struct: #export _ (Functor Random) - (def: (map f fa) - (lambda [state] - (let [[state' a] (fa state)] - [state' (f a)])))) - -(struct: #export _ (Applicative Random) - (def: functor Functor) - - (def: (wrap a) - (lambda [state] - [state a])) - - (def: (apply ff fa) - (lambda [state] - (let [[state' f] (ff state) - [state'' a] (fa state')] - [state'' (f a)])))) - -(struct: #export _ (Monad Random) - (def: applicative Applicative) - - (def: (join ffa) - (lambda [state] - (let [[state' fa] (ffa state)] - (fa state'))))) - -(def: #export nat - (Random Nat) - (lambda [prng] - (let [[prng left] (prng []) - [prng right] (prng [])] - [prng (n.+ (bit;<< +32 left) - right)]))) - -(def: #export int - (Random Int) - (lambda [prng] - (let [[prng left] (prng []) - [prng right] (prng [])] - [prng (nat-to-int (n.+ (bit;<< +32 left) - right))]))) - -(def: #export bool - (Random Bool) - (lambda [prng] - (let [[prng output] (prng [])] - [prng (|> output (bit;& +1) (n.= +1))]))) - -(def: (bits n) - (-> Nat (Random Nat)) - (lambda [prng] - (let [[prng output] (prng [])] - [prng (bit;>>> (n.- n +64) output)]))) - -(def: #export real - (Random Real) - (do Monad - [left (bits +26) - right (bits +27)] - (wrap (|> right - (n.+ (bit;<< +27 left)) - nat-to-int - int-to-real - (r./ (|> +1 (bit;<< +53) nat-to-int int-to-real)))))) - -(def: #export frac - (Random Frac) - (:: Monad map real-to-frac real)) - -(def: #export char - (Random Char) - (do Monad - [base nat] - (wrap (char;char base)))) - -(def: #export (text' char-gen size) - (-> (Random Char) Nat (Random Text)) - (if (n.= +0 size) - (:: Monad wrap "") - (do Monad - [x char-gen - xs (text' char-gen (n.dec size))] - (wrap (Text/append (char;as-text x) xs))))) - -(def: #export (text size) - (-> Nat (Random Text)) - (text' char size)) - -(do-template [ ] - [(def: #export - (Random ) - (do Monad - [left - right ] - (wrap ( left right))))] - - [ratio r;Ratio r;ratio nat] - [complex c;Complex c;complex real] - ) - -(def: #export (seq left right) - {#;doc "Sequencing combinator."} - (All [a b] (-> (Random a) (Random b) (Random [a b]))) - (do Monad - [=left left - =right right] - (wrap [=left =right]))) - -(def: #export (alt left right) - {#;doc "Heterogeneous alternative combinator."} - (All [a b] (-> (Random a) (Random b) (Random (| a b)))) - (do Monad - [? bool] - (if ? - (do @ - [=left left] - (wrap (+0 =left))) - (do @ - [=right right] - (wrap (+1 =right)))))) - -(def: #export (either left right) - {#;doc "Homogeneous alternative combinator."} - (All [a] (-> (Random a) (Random a) (Random a))) - (do Monad - [? bool] - (if ? - left - right))) - -(def: #export (rec gen) - {#;doc "A combinator for producing recursive random generators."} - (All [a] (-> (-> (Random a) (Random a)) (Random a))) - (lambda [state] - (let [gen' (gen (rec gen))] - (gen' state)))) - -(def: #export (filter pred gen) - {#;doc "Retries the generator until the output satisfies a predicate."} - (All [a] (-> (-> a Bool) (Random a) (Random a))) - (do Monad - [sample gen] - (if (pred sample) - (wrap sample) - (filter pred gen)))) - -(def: #export (maybe value-gen) - (All [a] (-> (Random a) (Random (Maybe a)))) - (do Monad - [some? bool] - (if some? - (do @ - [value value-gen] - (wrap (#;Some value))) - (wrap #;None)))) - -(do-template [ ] - [(def: #export ( size value-gen) - (All [a] (-> Nat (Random a) (Random ( a)))) - (if (n.> +0 size) - (do Monad - [x value-gen - xs ( (n.dec size) value-gen)] - (wrap ( x xs))) - (:: Monad wrap )))] - - [list List (;list) #;Cons] - [vector V;Vector V;empty V;add] - ) - -(do-template [ ] - [(def: #export ( size value-gen) - (All [a] (-> Nat (Random a) (Random ( a)))) - (do Monad - [values (list size value-gen)] - (wrap (|> values ))))] - - [array A;Array A;from-list] - [queue Q;Queue Q;from-list] - [stack ST;Stack (List/fold ST;push ST;empty)] - ) - -(def: #export (set Hash size value-gen) - (All [a] (-> (Hash a) Nat (Random a) (Random (S;Set a)))) - (if (n.> +0 size) - (do Monad - [xs (set Hash (n.dec size) value-gen)] - (loop [_ []] - (do @ - [x value-gen - #let [xs+ (S;add x xs)]] - (if (n.= size (S;size xs+)) - (wrap xs+) - (recur []))))) - (:: Monad wrap (S;new Hash)))) - -(def: #export (dict Hash size key-gen value-gen) - (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (D;Dict k v)))) - (if (n.> +0 size) - (do Monad - [kv (dict Hash (n.dec size) key-gen value-gen)] - (loop [_ []] - (do @ - [k key-gen - v value-gen - #let [kv+ (D;put k v kv)]] - (if (n.= size (D;size kv+)) - (wrap kv+) - (recur []))))) - (:: Monad wrap (D;new Hash)))) - -(def: #export (run prng calc) - (All [a] (-> PRNG (Random a) [PRNG a])) - (calc prng)) - -## [PRNGs] -## PCG32 http://www.pcg-random.org/ -## Based on this Java implementation: https://github.com/alexeyr/pcg-java - -(def: pcg-32-magic-mult Nat +6364136223846793005) - -(def: #export (pcg-32 [inc seed]) - {#;doc "An implementation of the PCG32 algorithm. - - For more information, please see: http://www.pcg-random.org/"} - (-> [Nat Nat] PRNG) - (lambda [_] - (let [seed' (|> seed (n.* pcg-32-magic-mult) (n.+ inc)) - xor-shifted (|> seed (bit;>>> +18) (bit;^ seed) (bit;>>> +27)) - rot (|> seed (bit;>>> +59))] - [(pcg-32 [inc seed']) (bit;rotate-right rot xor-shifted)] - ))) - -## Xoroshiro128+ http://xoroshiro.di.unimi.it/ -(def: #export (xoroshiro-128+ [s0 s1]) - {#;doc "An implementation of the Xoroshiro128+ algorithm. - - For more information, please see: http://xoroshiro.di.unimi.it/"} - (-> [Nat Nat] PRNG) - (lambda [_] - (let [result (n.+ s0 s1) - s01 (bit;^ s0 s1) - s0' (|> (bit;rotate-left +55 s0) - (bit;^ s01) - (bit;^ (bit;<< +14 s01))) - s1' (bit;rotate-left +36 s01)] - [(xoroshiro-128+ [s0' s1']) result]) - )) - -## [Values] -(def: (swap from to vec) - (All [a] (-> Nat Nat (V;Vector a) (V;Vector a))) - (V;put to (default (undefined) - (V;at from vec)) - vec)) - -(def: #export (shuffle seed vector) - {#;doc "Shuffle a vector randomly based on a seed value."} - (All [a] (-> Nat (V;Vector a) (V;Vector a))) - (let [_size (V;size vector) - _shuffle (foldM Monad - (lambda [idx vec] - (do Monad - [rand nat] - (wrap (swap idx (n.% _size rand) vec)))) - vector - (list;n.range +0 (n.dec _size)))] - (|> _shuffle - (run (pcg-32 [+123 seed])) - product;right))) diff --git a/stdlib/source/lux/random.lux b/stdlib/source/lux/random.lux new file mode 100644 index 000000000..802dbfae6 --- /dev/null +++ b/stdlib/source/lux/random.lux @@ -0,0 +1,307 @@ +## Copyright (c) Eduardo Julian. All rights reserved. +## This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +## If a copy of the MPL was not distributed with this file, +## You can obtain one at http://mozilla.org/MPL/2.0/. + +(;module: {#;doc "Pseudo-random number generation (PRNG) algorithms."} + [lux #- list] + (lux (control functor + applicative + monad + hash) + (data [bit] + [char] + [text "Text/" Monoid] + text/format + [product] + [number] + (struct [list "List/" Fold] + ["A" array] + ["D" dict] + ["Q" queue] + ["S" set] + ["ST" stack] + ["V" vector])) + (math ["r" ratio] + ["c" complex]))) + +## [Exports] +(type: #export #rec PRNG + {#;doc "An abstract way to represent any PRNG."} + (-> Unit [PRNG Nat])) + +(type: #export (Random a) + {#;doc "A producer of random values based on a PRNG."} + (-> PRNG [PRNG a])) + +(struct: #export _ (Functor Random) + (def: (map f fa) + (lambda [state] + (let [[state' a] (fa state)] + [state' (f a)])))) + +(struct: #export _ (Applicative Random) + (def: functor Functor) + + (def: (wrap a) + (lambda [state] + [state a])) + + (def: (apply ff fa) + (lambda [state] + (let [[state' f] (ff state) + [state'' a] (fa state')] + [state'' (f a)])))) + +(struct: #export _ (Monad Random) + (def: applicative Applicative) + + (def: (join ffa) + (lambda [state] + (let [[state' fa] (ffa state)] + (fa state'))))) + +(def: #export nat + (Random Nat) + (lambda [prng] + (let [[prng left] (prng []) + [prng right] (prng [])] + [prng (n.+ (bit;<< +32 left) + right)]))) + +(def: #export int + (Random Int) + (lambda [prng] + (let [[prng left] (prng []) + [prng right] (prng [])] + [prng (nat-to-int (n.+ (bit;<< +32 left) + right))]))) + +(def: #export bool + (Random Bool) + (lambda [prng] + (let [[prng output] (prng [])] + [prng (|> output (bit;& +1) (n.= +1))]))) + +(def: (bits n) + (-> Nat (Random Nat)) + (lambda [prng] + (let [[prng output] (prng [])] + [prng (bit;>>> (n.- n +64) output)]))) + +(def: #export real + (Random Real) + (do Monad + [left (bits +26) + right (bits +27)] + (wrap (|> right + (n.+ (bit;<< +27 left)) + nat-to-int + int-to-real + (r./ (|> +1 (bit;<< +53) nat-to-int int-to-real)))))) + +(def: #export frac + (Random Frac) + (:: Monad map real-to-frac real)) + +(def: #export char + (Random Char) + (do Monad + [base nat] + (wrap (char;char base)))) + +(def: #export (text' char-gen size) + (-> (Random Char) Nat (Random Text)) + (if (n.= +0 size) + (:: Monad wrap "") + (do Monad + [x char-gen + xs (text' char-gen (n.dec size))] + (wrap (Text/append (char;as-text x) xs))))) + +(def: #export (text size) + (-> Nat (Random Text)) + (text' char size)) + +(do-template [ ] + [(def: #export + (Random ) + (do Monad + [left + right ] + (wrap ( left right))))] + + [ratio r;Ratio r;ratio nat] + [complex c;Complex c;complex real] + ) + +(def: #export (seq left right) + {#;doc "Sequencing combinator."} + (All [a b] (-> (Random a) (Random b) (Random [a b]))) + (do Monad + [=left left + =right right] + (wrap [=left =right]))) + +(def: #export (alt left right) + {#;doc "Heterogeneous alternative combinator."} + (All [a b] (-> (Random a) (Random b) (Random (| a b)))) + (do Monad + [? bool] + (if ? + (do @ + [=left left] + (wrap (+0 =left))) + (do @ + [=right right] + (wrap (+1 =right)))))) + +(def: #export (either left right) + {#;doc "Homogeneous alternative combinator."} + (All [a] (-> (Random a) (Random a) (Random a))) + (do Monad + [? bool] + (if ? + left + right))) + +(def: #export (rec gen) + {#;doc "A combinator for producing recursive random generators."} + (All [a] (-> (-> (Random a) (Random a)) (Random a))) + (lambda [state] + (let [gen' (gen (rec gen))] + (gen' state)))) + +(def: #export (filter pred gen) + {#;doc "Retries the generator until the output satisfies a predicate."} + (All [a] (-> (-> a Bool) (Random a) (Random a))) + (do Monad + [sample gen] + (if (pred sample) + (wrap sample) + (filter pred gen)))) + +(def: #export (maybe value-gen) + (All [a] (-> (Random a) (Random (Maybe a)))) + (do Monad + [some? bool] + (if some? + (do @ + [value value-gen] + (wrap (#;Some value))) + (wrap #;None)))) + +(do-template [ ] + [(def: #export ( size value-gen) + (All [a] (-> Nat (Random a) (Random ( a)))) + (if (n.> +0 size) + (do Monad + [x value-gen + xs ( (n.dec size) value-gen)] + (wrap ( x xs))) + (:: Monad wrap )))] + + [list List (;list) #;Cons] + [vector V;Vector V;empty V;add] + ) + +(do-template [ ] + [(def: #export ( size value-gen) + (All [a] (-> Nat (Random a) (Random ( a)))) + (do Monad + [values (list size value-gen)] + (wrap (|> values ))))] + + [array A;Array A;from-list] + [queue Q;Queue Q;from-list] + [stack ST;Stack (List/fold ST;push ST;empty)] + ) + +(def: #export (set Hash size value-gen) + (All [a] (-> (Hash a) Nat (Random a) (Random (S;Set a)))) + (if (n.> +0 size) + (do Monad + [xs (set Hash (n.dec size) value-gen)] + (loop [_ []] + (do @ + [x value-gen + #let [xs+ (S;add x xs)]] + (if (n.= size (S;size xs+)) + (wrap xs+) + (recur []))))) + (:: Monad wrap (S;new Hash)))) + +(def: #export (dict Hash size key-gen value-gen) + (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (D;Dict k v)))) + (if (n.> +0 size) + (do Monad + [kv (dict Hash (n.dec size) key-gen value-gen)] + (loop [_ []] + (do @ + [k key-gen + v value-gen + #let [kv+ (D;put k v kv)]] + (if (n.= size (D;size kv+)) + (wrap kv+) + (recur []))))) + (:: Monad wrap (D;new Hash)))) + +(def: #export (run prng calc) + (All [a] (-> PRNG (Random a) [PRNG a])) + (calc prng)) + +## [PRNGs] +## PCG32 http://www.pcg-random.org/ +## Based on this Java implementation: https://github.com/alexeyr/pcg-java + +(def: pcg-32-magic-mult Nat +6364136223846793005) + +(def: #export (pcg-32 [inc seed]) + {#;doc "An implementation of the PCG32 algorithm. + + For more information, please see: http://www.pcg-random.org/"} + (-> [Nat Nat] PRNG) + (lambda [_] + (let [seed' (|> seed (n.* pcg-32-magic-mult) (n.+ inc)) + xor-shifted (|> seed (bit;>>> +18) (bit;^ seed) (bit;>>> +27)) + rot (|> seed (bit;>>> +59))] + [(pcg-32 [inc seed']) (bit;rotate-right rot xor-shifted)] + ))) + +## Xoroshiro128+ http://xoroshiro.di.unimi.it/ +(def: #export (xoroshiro-128+ [s0 s1]) + {#;doc "An implementation of the Xoroshiro128+ algorithm. + + For more information, please see: http://xoroshiro.di.unimi.it/"} + (-> [Nat Nat] PRNG) + (lambda [_] + (let [result (n.+ s0 s1) + s01 (bit;^ s0 s1) + s0' (|> (bit;rotate-left +55 s0) + (bit;^ s01) + (bit;^ (bit;<< +14 s01))) + s1' (bit;rotate-left +36 s01)] + [(xoroshiro-128+ [s0' s1']) result]) + )) + +## [Values] +(def: (swap from to vec) + (All [a] (-> Nat Nat (V;Vector a) (V;Vector a))) + (V;put to (default (undefined) + (V;at from vec)) + vec)) + +(def: #export (shuffle seed vector) + {#;doc "Shuffle a vector randomly based on a seed value."} + (All [a] (-> Nat (V;Vector a) (V;Vector a))) + (let [_size (V;size vector) + _shuffle (foldM Monad + (lambda [idx vec] + (do Monad + [rand nat] + (wrap (swap idx (n.% _size rand) vec)))) + vector + (list;n.range +0 (n.dec _size)))] + (|> _shuffle + (run (pcg-32 [+123 seed])) + product;right))) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index e2bff250e..4bebfe10c 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -18,7 +18,7 @@ text/format [error #- fail "Error/" Monad]) (codata [io #- run]) - (math ["R" random]) + ["R" random] [host #- try])) ## [Host] diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index 5b530ba98..6c1ea6f4b 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -9,7 +9,7 @@ (lux (control monad) (codata [io]) [math] - (math ["R" random]) + ["R" random] (data [text "T/" Eq] text/format) [compiler] diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index 31f119828..2aab87ae4 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -15,7 +15,7 @@ (struct [list])) (codata function) ["&" cli] - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/codata/cont.lux b/stdlib/test/test/lux/codata/cont.lux index 251f8f50d..39fdd6f42 100644 --- a/stdlib/test/test/lux/codata/cont.lux +++ b/stdlib/test/test/lux/codata/cont.lux @@ -13,7 +13,7 @@ [product]) (codata function ["&" cont]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/codata/struct/stream.lux b/stdlib/test/test/lux/codata/struct/stream.lux index 6a86de2da..41132b2ee 100644 --- a/stdlib/test/test/lux/codata/struct/stream.lux +++ b/stdlib/test/test/lux/codata/struct/stream.lux @@ -15,7 +15,7 @@ (codata function [cont] (struct ["&" stream])) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/concurrency/atom.lux b/stdlib/test/test/lux/concurrency/atom.lux index 6e92e364d..312bc0369 100644 --- a/stdlib/test/test/lux/concurrency/atom.lux +++ b/stdlib/test/test/lux/concurrency/atom.lux @@ -11,7 +11,7 @@ (struct [list "" Functor]) text/format) (concurrency ["&" atom]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 51a62df7f..53accdfcc 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -12,7 +12,7 @@ (concurrency ["&" promise]) (codata function [io #- run]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index 2f0b7d99c..5b385c685 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -13,7 +13,7 @@ (concurrency ["&" stm] [promise]) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/control/effect.lux b/stdlib/test/test/lux/control/effect.lux index cffdbd561..be7eda3aa 100644 --- a/stdlib/test/test/lux/control/effect.lux +++ b/stdlib/test/test/lux/control/effect.lux @@ -11,7 +11,7 @@ (data [text] text/format) [macro] - (math ["R" random]) + ["R" random] pipe (control effect)) lux/test) diff --git a/stdlib/test/test/lux/data/bit.lux b/stdlib/test/test/lux/data/bit.lux index 5aca04332..0b66b30f5 100644 --- a/stdlib/test/test/lux/data/bit.lux +++ b/stdlib/test/test/lux/data/bit.lux @@ -9,7 +9,7 @@ (codata [io]) (data ["&" bit] number) - (math ["R" random])) + ["R" random]) lux/test) (def: width Nat +64) diff --git a/stdlib/test/test/lux/data/bool.lux b/stdlib/test/test/lux/data/bool.lux index 218846e2e..4c196546c 100644 --- a/stdlib/test/test/lux/data/bool.lux +++ b/stdlib/test/test/lux/data/bool.lux @@ -8,7 +8,7 @@ (lux (control [monad]) (codata [io]) (data bool) - (math ["R" random])) + ["R" random]) lux/test) (test: "Boolean operations." diff --git a/stdlib/test/test/lux/data/char.lux b/stdlib/test/test/lux/data/char.lux index cd3b7e101..6482dd219 100644 --- a/stdlib/test/test/lux/data/char.lux +++ b/stdlib/test/test/lux/data/char.lux @@ -10,7 +10,7 @@ (data char [text] text/format) - (math ["R" random]) + ["R" random] pipe [host #- try]) lux/test) diff --git a/stdlib/test/test/lux/data/error/exception.lux b/stdlib/test/test/lux/data/error/exception.lux index 42fe448db..312bca2a2 100644 --- a/stdlib/test/test/lux/data/error/exception.lux +++ b/stdlib/test/test/lux/data/error/exception.lux @@ -13,7 +13,7 @@ text/format [number]) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index 4564f1ba4..06c29707f 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -25,7 +25,7 @@ (macro [ast] [syntax #+ syntax:] [poly #+ derived:]) - (math ["R" random]) + ["R" random] pipe test) ) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index 14adc5371..70a8d2a58 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -10,7 +10,7 @@ (data ["&" ident] [text "Text/" Eq] text/format) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index 832c8fbdd..20d72adf6 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -10,7 +10,7 @@ (data number [text "Text/" Monoid Eq] text/format) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/array.lux b/stdlib/test/test/lux/data/struct/array.lux index 1b81ecf47..ae7ff4bbc 100644 --- a/stdlib/test/test/lux/data/struct/array.lux +++ b/stdlib/test/test/lux/data/struct/array.lux @@ -10,7 +10,7 @@ (data (struct ["&" array] [list]) [number]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/dict.lux b/stdlib/test/test/lux/data/struct/dict.lux index acd878e8d..b467e232a 100644 --- a/stdlib/test/test/lux/data/struct/dict.lux +++ b/stdlib/test/test/lux/data/struct/dict.lux @@ -15,7 +15,7 @@ (struct ["&" dict] [list "List/" Fold Functor])) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/list.lux b/stdlib/test/test/lux/data/struct/list.lux index db0a14f56..b40615036 100644 --- a/stdlib/test/test/lux/data/struct/list.lux +++ b/stdlib/test/test/lux/data/struct/list.lux @@ -12,7 +12,7 @@ [number] [bool] [product]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/queue.lux b/stdlib/test/test/lux/data/struct/queue.lux index 095d066f6..d92fecf10 100644 --- a/stdlib/test/test/lux/data/struct/queue.lux +++ b/stdlib/test/test/lux/data/struct/queue.lux @@ -9,7 +9,7 @@ (control monad) (data (struct ["&" queue]) [number]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/set.lux b/stdlib/test/test/lux/data/struct/set.lux index 27d80959f..ae709384f 100644 --- a/stdlib/test/test/lux/data/struct/set.lux +++ b/stdlib/test/test/lux/data/struct/set.lux @@ -10,7 +10,7 @@ (data (struct ["&" set] [list "" Fold]) [number]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/stack.lux b/stdlib/test/test/lux/data/struct/stack.lux index 375c19b4b..001eb1af1 100644 --- a/stdlib/test/test/lux/data/struct/stack.lux +++ b/stdlib/test/test/lux/data/struct/stack.lux @@ -10,7 +10,7 @@ (data (struct ["&" stack] [list "" Fold]) [number]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/tree.lux b/stdlib/test/test/lux/data/struct/tree.lux index 3c60628e5..91a81355e 100644 --- a/stdlib/test/test/lux/data/struct/tree.lux +++ b/stdlib/test/test/lux/data/struct/tree.lux @@ -10,7 +10,7 @@ (data (struct ["&" tree] [list "List/" Monad]) [number]) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/vector.lux b/stdlib/test/test/lux/data/struct/vector.lux index 76e4f7580..35663c63a 100644 --- a/stdlib/test/test/lux/data/struct/vector.lux +++ b/stdlib/test/test/lux/data/struct/vector.lux @@ -13,7 +13,7 @@ text/format [number]) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/struct/zipper.lux b/stdlib/test/test/lux/data/struct/zipper.lux index 8e45b4ef1..37ada2859 100644 --- a/stdlib/test/test/lux/data/struct/zipper.lux +++ b/stdlib/test/test/lux/data/struct/zipper.lux @@ -14,7 +14,7 @@ text/format [number]) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index df2e621a9..14f58aedb 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -13,7 +13,7 @@ [number] (struct [list])) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/host.lux b/stdlib/test/test/lux/host.lux index 41e171eb7..03ed87772 100644 --- a/stdlib/test/test/lux/host.lux +++ b/stdlib/test/test/lux/host.lux @@ -13,7 +13,7 @@ (codata function [io]) ["&" host #+ jvm-import class: interface: object] - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/lexer.lux b/stdlib/test/test/lux/lexer.lux index fc51deafd..7e7408428 100644 --- a/stdlib/test/test/lux/lexer.lux +++ b/stdlib/test/test/lux/lexer.lux @@ -12,7 +12,7 @@ text/format [char "C/" Eq] (struct [list])) - (math ["R" random]) + ["R" random] pipe ["&" lexer]) lux/test) diff --git a/stdlib/test/test/lux/macro/ast.lux b/stdlib/test/test/lux/macro/ast.lux index a10486edc..61127bef7 100644 --- a/stdlib/test/test/lux/macro/ast.lux +++ b/stdlib/test/test/lux/macro/ast.lux @@ -11,7 +11,7 @@ (data [text "T/" Eq] text/format [number]) - (math ["R" random]) + ["R" random] pipe (macro ["&" ast])) lux/test) diff --git a/stdlib/test/test/lux/macro/poly/eq.lux b/stdlib/test/test/lux/macro/poly/eq.lux index 983d2da69..4f4c296d6 100644 --- a/stdlib/test/test/lux/macro/poly/eq.lux +++ b/stdlib/test/test/lux/macro/poly/eq.lux @@ -13,7 +13,7 @@ [number "i/" Number] [char] [text]) - (math ["R" random]) + ["R" random] pipe [macro] (macro [poly #+ derived:] diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux index c25f536e9..23d42c78d 100644 --- a/stdlib/test/test/lux/macro/poly/functor.lux +++ b/stdlib/test/test/lux/macro/poly/functor.lux @@ -14,7 +14,7 @@ [number "i/" Number] [char] [text]) - (math ["R" random]) + ["R" random] pipe [macro] (macro [poly #+ derived:] diff --git a/stdlib/test/test/lux/macro/poly/text-encoder.lux b/stdlib/test/test/lux/macro/poly/text-encoder.lux index e106162a3..154d9ab10 100644 --- a/stdlib/test/test/lux/macro/poly/text-encoder.lux +++ b/stdlib/test/test/lux/macro/poly/text-encoder.lux @@ -13,7 +13,7 @@ [number "i/" Number] [char] [text]) - (math ["R" random]) + ["R" random] pipe [macro] (macro [poly #+ derived:] diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 17d4c935b..aaa042fb3 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -16,7 +16,7 @@ [ident] [error #- fail]) (codata function) - (math ["R" random]) + ["R" random] pipe [compiler] (macro [ast] diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 9765d69d8..1ffba0aa2 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -14,7 +14,7 @@ (struct [list "List/" Fold Functor]) [product]) (codata function) - (math ["R" random]) + ["R" random] pipe ["&" math]) lux/test) diff --git a/stdlib/test/test/lux/math/complex.lux b/stdlib/test/test/lux/math/complex.lux index fad780410..f9743e9ec 100644 --- a/stdlib/test/test/lux/math/complex.lux +++ b/stdlib/test/test/lux/math/complex.lux @@ -15,7 +15,7 @@ [product]) (codata function) [math] - (math ["R" random]) + ["R" random] pipe ["&" math/complex]) lux/test) diff --git a/stdlib/test/test/lux/math/ratio.lux b/stdlib/test/test/lux/math/ratio.lux index 55e6fe920..0cdbf4f93 100644 --- a/stdlib/test/test/lux/math/ratio.lux +++ b/stdlib/test/test/lux/math/ratio.lux @@ -14,7 +14,7 @@ (struct [list "List/" Fold Functor]) [product]) (codata function) - (math ["R" random]) + ["R" random] pipe ["&" math/ratio "&/" Number]) lux/test) diff --git a/stdlib/test/test/lux/math/simple.lux b/stdlib/test/test/lux/math/simple.lux index 25ae00d23..bfa313708 100644 --- a/stdlib/test/test/lux/math/simple.lux +++ b/stdlib/test/test/lux/math/simple.lux @@ -14,7 +14,7 @@ (struct [list "List/" Fold Functor]) [product]) (codata function) - (math ["R" random]) + ["R" random] pipe ["&" math/simple]) lux/test) diff --git a/stdlib/test/test/lux/pipe.lux b/stdlib/test/test/lux/pipe.lux index 92ca205b8..86f45079f 100644 --- a/stdlib/test/test/lux/pipe.lux +++ b/stdlib/test/test/lux/pipe.lux @@ -13,7 +13,7 @@ identity [text "T/" Eq]) (codata function) - (math ["R" random]) + ["R" random] pipe) lux/test) diff --git a/stdlib/test/test/lux/regex.lux b/stdlib/test/test/lux/regex.lux index 00be2c2d8..281e6dbad 100644 --- a/stdlib/test/test/lux/regex.lux +++ b/stdlib/test/test/lux/regex.lux @@ -14,7 +14,7 @@ [compiler] (macro [ast] ["s" syntax #+ syntax:]) - (math ["R" random]) + ["R" random] pipe [lexer] ["&" regex]) diff --git a/stdlib/test/test/lux/type.lux b/stdlib/test/test/lux/type.lux index 4bf5de8ae..1670f3146 100644 --- a/stdlib/test/test/lux/type.lux +++ b/stdlib/test/test/lux/type.lux @@ -12,7 +12,7 @@ [number] maybe (struct [list])) - (math ["R" random]) + ["R" random] pipe ["&" type]) lux/test) diff --git a/stdlib/test/test/lux/type/auto.lux b/stdlib/test/test/lux/type/auto.lux index f759827f0..fdc1ec51a 100644 --- a/stdlib/test/test/lux/type/auto.lux +++ b/stdlib/test/test/lux/type/auto.lux @@ -15,7 +15,7 @@ [bool "B/" Eq] maybe (struct [list])) - (math ["R" random]) + ["R" random] pipe [type] type/auto) diff --git a/stdlib/test/test/lux/type/check.lux b/stdlib/test/test/lux/type/check.lux index 817f40273..2dadd92f2 100644 --- a/stdlib/test/test/lux/type/check.lux +++ b/stdlib/test/test/lux/type/check.lux @@ -12,7 +12,7 @@ [number] maybe (struct [list])) - (math ["R" random]) + ["R" random] pipe [type] ["&" type/check]) -- cgit v1.2.3