aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2017-01-25 20:30:44 -0400
committerEduardo Julian2017-01-25 20:30:44 -0400
commit216a12cd02337c83c889a667063e0c06f2944e65 (patch)
tree5394a1bbf8df4d28de5625fd1803bf2ccbbe1a04 /stdlib/source
parent0a9547eed8546519e883bc40a38104842de2988c (diff)
- Moved the lux/data/struct/* modules to lux/data/coll/*.
- Did the same for the lux/codata/struct/* modules. - Moved lux/codata/io to lux/io. - Moved lux/control/effect to lux/effect. - Renamed "sample" functions to "this" functions. - Renamed "at" functions to "nth" functions.
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux.lux14
-rw-r--r--stdlib/source/lux/cli.lux4
-rw-r--r--stdlib/source/lux/codata/coll/stream.lux (renamed from stdlib/source/lux/codata/struct/stream.lux)6
-rw-r--r--stdlib/source/lux/codata/cont.lux10
-rw-r--r--stdlib/source/lux/compiler.lux2
-rw-r--r--stdlib/source/lux/concurrency/actor.lux10
-rw-r--r--stdlib/source/lux/concurrency/atom.lux2
-rw-r--r--stdlib/source/lux/concurrency/frp.lux6
-rw-r--r--stdlib/source/lux/concurrency/promise.lux6
-rw-r--r--stdlib/source/lux/concurrency/stm.lux8
-rw-r--r--stdlib/source/lux/control/comonad.lux2
-rw-r--r--stdlib/source/lux/data/char.lux4
-rw-r--r--stdlib/source/lux/data/coll/array.lux (renamed from stdlib/source/lux/data/struct/array.lux)2
-rw-r--r--stdlib/source/lux/data/coll/dict.lux (renamed from stdlib/source/lux/data/struct/dict.lux)4
-rw-r--r--stdlib/source/lux/data/coll/list.lux (renamed from stdlib/source/lux/data/struct/list.lux)4
-rw-r--r--stdlib/source/lux/data/coll/queue.lux (renamed from stdlib/source/lux/data/struct/queue.lux)2
-rw-r--r--stdlib/source/lux/data/coll/set.lux (renamed from stdlib/source/lux/data/struct/set.lux)4
-rw-r--r--stdlib/source/lux/data/coll/stack.lux (renamed from stdlib/source/lux/data/struct/stack.lux)2
-rw-r--r--stdlib/source/lux/data/coll/tree/rose.lux (renamed from stdlib/source/lux/data/struct/tree/rose.lux)2
-rw-r--r--stdlib/source/lux/data/coll/tree/zipper.lux (renamed from stdlib/source/lux/data/struct/tree/zipper.lux)6
-rw-r--r--stdlib/source/lux/data/coll/vector.lux (renamed from stdlib/source/lux/data/struct/vector.lux)8
-rw-r--r--stdlib/source/lux/data/format/json.lux22
-rw-r--r--stdlib/source/lux/data/text.lux4
-rw-r--r--stdlib/source/lux/data/text/format.lux2
-rw-r--r--stdlib/source/lux/effect.lux (renamed from stdlib/source/lux/control/effect.lux)6
-rw-r--r--stdlib/source/lux/host.lux100
-rw-r--r--stdlib/source/lux/io.lux (renamed from stdlib/source/lux/codata/io.lux)2
-rw-r--r--stdlib/source/lux/lexer.lux14
-rw-r--r--stdlib/source/lux/lexer/regex.lux2
-rw-r--r--stdlib/source/lux/macro.lux4
-rw-r--r--stdlib/source/lux/macro/ast.lux2
-rw-r--r--stdlib/source/lux/macro/poly.lux4
-rw-r--r--stdlib/source/lux/macro/poly/eq.lux4
-rw-r--r--stdlib/source/lux/macro/poly/functor.lux4
-rw-r--r--stdlib/source/lux/macro/poly/text-encoder.lux4
-rw-r--r--stdlib/source/lux/macro/syntax.lux6
-rw-r--r--stdlib/source/lux/macro/syntax/common.lux22
-rw-r--r--stdlib/source/lux/math.lux4
-rw-r--r--stdlib/source/lux/math/complex.lux2
-rw-r--r--stdlib/source/lux/math/simple.lux2
-rw-r--r--stdlib/source/lux/pipe.lux2
-rw-r--r--stdlib/source/lux/random.lux16
-rw-r--r--stdlib/source/lux/test.lux8
-rw-r--r--stdlib/source/lux/type.lux4
-rw-r--r--stdlib/source/lux/type/auto.lux4
-rw-r--r--stdlib/source/lux/type/check.lux4
46 files changed, 181 insertions, 175 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index bb53b987e..f86d8cdae 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -3234,7 +3234,7 @@
(list module)
(list& (substring2 0 idx module) (split-module (substring1 (i.+ 1 idx) module))))))
-(def: (at idx xs)
+(def: (nth idx xs)
(All [a]
(-> Int (List a) (Maybe a)))
(case xs
@@ -3244,7 +3244,7 @@
(#Cons x xs')
(if (i.= idx 0)
(#Some x)
- (at (i.- 1 idx) xs')
+ (nth (i.- 1 idx) xs')
)))
(def: (beta-reduce env type)
@@ -3279,7 +3279,7 @@
(#LambdaT (beta-reduce env ?input) (beta-reduce env ?output))
(#BoundT idx)
- (case (at (_lux_proc ["nat" "to-int"] [idx]) env)
+ (case (nth (_lux_proc ["nat" "to-int"] [idx]) env)
(#Some bound)
bound
@@ -3870,7 +3870,7 @@
num-ups (length ups)]
(if (i.= num-ups 0)
(return module)
- (case (at num-ups (split-module-contexts module-name))
+ (case (nth num-ups (split-module-contexts module-name))
#None
(fail (Text/append "Can't clean module: " module))
@@ -4491,7 +4491,7 @@
lux
(lux (control (monad #as M #refer #all))
(data (text #open (\"Text/\" Monoid<Text>))
- (struct (list #open (\"List/\" Monad<List>)))
+ (coll (list #open (\"List/\" Monad<List>)))
maybe
(ident #open (\"Ident/\" Codec<Text,Ident>)))
meta
@@ -4502,7 +4502,7 @@
lux
(lux (control [\"M\" monad #*])
(data [text \"Text/\" Monoid<Text>]
- (struct [list \"List/\" Monad<List>])
+ (coll [list \"List/\" Monad<List>])
maybe
[ident \"Ident/\" Codec<Text,Ident>])
meta
@@ -4735,7 +4735,7 @@
[#;ExQ])
(#;BoundT idx)
- (default type (list;at idx env))
+ (default type (list;nth idx env))
_
type
diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux
index a8604180b..410cd42d5 100644
--- a/stdlib/source/lux/cli.lux
+++ b/stdlib/source/lux/cli.lux
@@ -8,11 +8,11 @@
(lux (control functor
applicative
monad)
- (data (struct (list #as list #open ("List/" Monoid<List> Monad<List>)))
+ (data (coll (list #as list #open ("List/" Monoid<List> Monad<List>)))
(text #as text #open ("Text/" Monoid<Text>))
error
(sum #as sum))
- (codata [io])
+ [io]
[compiler #+ with-gensyms Functor<Lux> Monad<Lux>]
(macro [ast]
["s" syntax #+ syntax: Syntax])))
diff --git a/stdlib/source/lux/codata/struct/stream.lux b/stdlib/source/lux/codata/coll/stream.lux
index 5691b0c69..eeee1ccc2 100644
--- a/stdlib/source/lux/codata/struct/stream.lux
+++ b/stdlib/source/lux/codata/coll/stream.lux
@@ -10,7 +10,7 @@
comonad)
[compiler #+ with-gensyms]
(macro ["s" syntax #+ syntax: Syntax])
- (data (struct [list "List/" Monad<List>])
+ (data (coll [list "List/" Monad<List>])
bool)
(codata [cont #+ @lazy Cont])))
@@ -59,11 +59,11 @@
[head a h]
[tail (Stream a) t])
-(def: #export (at idx s)
+(def: #export (nth idx s)
(All [a] (-> Nat (Stream a) a))
(let [[h t] (cont;run s)]
(if (n.> +0 idx)
- (at (n.dec idx) t)
+ (nth (n.dec idx) t)
h)))
(do-template [<taker> <dropper> <splitter> <pred-type> <pred-test> <pred-step>]
diff --git a/stdlib/source/lux/codata/cont.lux b/stdlib/source/lux/codata/cont.lux
index 7f1b787e1..f04b6a0ba 100644
--- a/stdlib/source/lux/codata/cont.lux
+++ b/stdlib/source/lux/codata/cont.lux
@@ -9,7 +9,7 @@
(control functor
applicative
monad)
- (data (struct list)))
+ (data (coll list)))
(.. function))
## [Types]
@@ -42,11 +42,17 @@
(k a))
k)))
+(def: #export (continue f thunk)
+ {#;doc "Forces a continuation thunk to be evaluated."}
+ (All [i o]
+ (-> (-> i o) (Cont i o) o))
+ (thunk f))
+
(def: #export (run thunk)
{#;doc "Forces a continuation thunk to be evaluated."}
(All [a]
(-> (Cont a) a))
- (thunk id))
+ (continue id thunk))
## [Structs]
(struct: #export _ (Functor Cont)
diff --git a/stdlib/source/lux/compiler.lux b/stdlib/source/lux/compiler.lux
index 367217524..9f667ebce 100644
--- a/stdlib/source/lux/compiler.lux
+++ b/stdlib/source/lux/compiler.lux
@@ -9,7 +9,7 @@
(control functor
applicative
monad)
- (data (struct [list #* "List/" Monoid<List> Monad<List>])
+ (data (coll [list #* "List/" Monoid<List> Monad<List>])
[number]
[text "Text/" Monoid<Text> Eq<Text>]
[product]
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index e55386d9d..73529e987 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -6,11 +6,11 @@
(;module: {#;doc "The actor model of concurrency."}
lux
(lux (control monad)
- (codata [io #- run]
- function)
+ [io #- run]
+ (codata function)
(data [error #- fail]
text/format
- (struct [list "List/" Monoid<List> Monad<List>])
+ (coll [list "List/" Monoid<List> Monad<List>])
[product]
[number "Nat/" Codec<Text,Nat>])
[compiler #+ with-gensyms]
@@ -154,7 +154,7 @@
(def: method^
(Syntax Method)
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' method:))
+ [_ (s;this! (' method:))
vars (s;default (list) (s;tuple (s;some s;local-symbol)))
[name args] (s;form ($_ s;seq
s;local-symbol
@@ -171,7 +171,7 @@
(def: stop^
(Syntax AST)
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' stop:))]
+ [_ (s;this! (' stop:))]
s;any)))
(def: actor-decl^
diff --git a/stdlib/source/lux/concurrency/atom.lux b/stdlib/source/lux/concurrency/atom.lux
index ae8c7fa21..c879db02d 100644
--- a/stdlib/source/lux/concurrency/atom.lux
+++ b/stdlib/source/lux/concurrency/atom.lux
@@ -5,7 +5,7 @@
(;module:
lux
- (lux (codata [io #- run])
+ (lux [io #- run]
host))
(jvm-import (java.util.concurrent.atomic.AtomicReference V)
diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux
index 45b9e1839..14563e534 100644
--- a/stdlib/source/lux/concurrency/frp.lux
+++ b/stdlib/source/lux/concurrency/frp.lux
@@ -9,9 +9,9 @@
applicative
monad
eq)
- (codata [io #- run]
- function)
- (data (struct [list])
+ [io #- run]
+ (codata function)
+ (data (coll [list])
text/format)
[compiler]
(macro ["s" syntax #+ syntax: Syntax]))
diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux
index 1d33ee4ee..60cffe2fe 100644
--- a/stdlib/source/lux/concurrency/promise.lux
+++ b/stdlib/source/lux/concurrency/promise.lux
@@ -5,12 +5,12 @@
(;module:
lux
- (lux (data (struct [list #* "" Functor<List>])
+ (lux (data (coll [list #* "" Functor<List>])
number
text/format
error)
- (codata [io #- run]
- function)
+ [io #- run]
+ (codata function)
(control functor
applicative
monad)
diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux
index 06912a25a..b088bd607 100644
--- a/stdlib/source/lux/concurrency/stm.lux
+++ b/stdlib/source/lux/concurrency/stm.lux
@@ -8,10 +8,10 @@
(lux (control functor
applicative
monad)
- (codata [io #- run])
- (data (struct [list #* "List/" Functor<List>]
- [dict #+ Dict]
- ["Q" queue])
+ [io #- run]
+ (data (coll [list #* "List/" Functor<List>]
+ [dict #+ Dict]
+ ["Q" queue])
[product]
[text]
maybe
diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux
index 046511190..00d807ef1 100644
--- a/stdlib/source/lux/control/comonad.lux
+++ b/stdlib/source/lux/control/comonad.lux
@@ -6,7 +6,7 @@
(;module:
lux
["F" ../functor]
- [lux/data/struct/list #* "" Fold<List>])
+ [lux/data/coll/list #* "" Fold<List>])
## [Signatures]
(sig: #export (CoMonad w)
diff --git a/stdlib/source/lux/data/char.lux b/stdlib/source/lux/data/char.lux
index 9c9baaf20..49c247f93 100644
--- a/stdlib/source/lux/data/char.lux
+++ b/stdlib/source/lux/data/char.lux
@@ -65,13 +65,13 @@
(or (n.= +4 size)
(n.= +5 size)))
(if (n.= +4 size)
- (case (text;at +2 y)
+ (case (text;nth +2 y)
#;None
(#;Left (Text/append "Wrong syntax for Char: " y))
(#;Some char)
(#;Right char))
- (case [(text;at +2 y) (text;at +3 y)]
+ (case [(text;nth +2 y) (text;nth +3 y)]
[(#;Some #"\\") (#;Some char)]
(case char
#"t" (#;Right #"\t")
diff --git a/stdlib/source/lux/data/struct/array.lux b/stdlib/source/lux/data/coll/array.lux
index fa52df9f1..f95754262 100644
--- a/stdlib/source/lux/data/struct/array.lux
+++ b/stdlib/source/lux/data/coll/array.lux
@@ -12,7 +12,7 @@
eq
fold)
(data error
- (struct [list "List/" Fold<List>])
+ (coll [list "List/" Fold<List>])
[product])
))
diff --git a/stdlib/source/lux/data/struct/dict.lux b/stdlib/source/lux/data/coll/dict.lux
index 3b153d229..fe77d0bea 100644
--- a/stdlib/source/lux/data/struct/dict.lux
+++ b/stdlib/source/lux/data/coll/dict.lux
@@ -8,8 +8,8 @@
(lux (control hash
eq)
(data maybe
- (struct [list "List/" Fold<List> Functor<List> Monoid<List>]
- [array #+ Array "Array/" Functor<Array> Fold<Array>])
+ (coll [list "List/" Fold<List> Functor<List> Monoid<List>]
+ [array #+ Array "Array/" Functor<Array> Fold<Array>])
[bit]
[product]
text/format
diff --git a/stdlib/source/lux/data/struct/list.lux b/stdlib/source/lux/data/coll/list.lux
index 3228e1d78..9b0328b16 100644
--- a/stdlib/source/lux/data/struct/list.lux
+++ b/stdlib/source/lux/data/coll/list.lux
@@ -215,7 +215,7 @@
[every? true and]
[any? false or])
-(def: #export (at i xs)
+(def: #export (nth i xs)
{#;doc "Fetches the element at the specified index."}
(All [a]
(-> Nat (List a) (Maybe a)))
@@ -226,7 +226,7 @@
(#;Cons [x xs'])
(if (n.= +0 i)
(#;Some x)
- (at (n.dec i) xs'))))
+ (nth (n.dec i) xs'))))
## [Structures]
(struct: #export (Eq<List> Eq<a>)
diff --git a/stdlib/source/lux/data/struct/queue.lux b/stdlib/source/lux/data/coll/queue.lux
index 1c7fcdc3e..4dcac337c 100644
--- a/stdlib/source/lux/data/struct/queue.lux
+++ b/stdlib/source/lux/data/coll/queue.lux
@@ -6,7 +6,7 @@
(;module:
lux
(lux (control eq)
- (data (struct [list "List/" Monoid<List>]))))
+ (data (coll [list "List/" Monoid<List>]))))
## [Types]
(type: #export (Queue a)
diff --git a/stdlib/source/lux/data/struct/set.lux b/stdlib/source/lux/data/coll/set.lux
index 711ae4553..952e8f055 100644
--- a/stdlib/source/lux/data/struct/set.lux
+++ b/stdlib/source/lux/data/coll/set.lux
@@ -10,8 +10,8 @@
monad
eq
[hash #*])
- (data (struct [dict]
- [list "List/" Fold<List> Functor<List>]))
+ (data (coll [dict]
+ [list "List/" Fold<List> Functor<List>]))
(codata function)))
## [Types]
diff --git a/stdlib/source/lux/data/struct/stack.lux b/stdlib/source/lux/data/coll/stack.lux
index e62a74590..05364b832 100644
--- a/stdlib/source/lux/data/struct/stack.lux
+++ b/stdlib/source/lux/data/coll/stack.lux
@@ -5,7 +5,7 @@
(;module:
lux
- (lux (data (struct [list]))))
+ (lux (data (coll [list]))))
## [Types]
(type: #export (Stack a)
diff --git a/stdlib/source/lux/data/struct/tree/rose.lux b/stdlib/source/lux/data/coll/tree/rose.lux
index 8620e46a7..4c4f873d5 100644
--- a/stdlib/source/lux/data/struct/tree/rose.lux
+++ b/stdlib/source/lux/data/coll/tree/rose.lux
@@ -7,7 +7,7 @@
lux
(lux (control monad
eq)
- (data (struct [list "" Monad<List>]))
+ (data (coll [list "" Monad<List>]))
[compiler]
(macro [ast]
["s" syntax #+ syntax: Syntax])))
diff --git a/stdlib/source/lux/data/struct/tree/zipper.lux b/stdlib/source/lux/data/coll/tree/zipper.lux
index 74dbd024f..c154ed19c 100644
--- a/stdlib/source/lux/data/struct/tree/zipper.lux
+++ b/stdlib/source/lux/data/coll/tree/zipper.lux
@@ -5,9 +5,9 @@
(;module:
lux
- (lux (data (struct [list "" Monad<List> Fold<List> "List/" Monoid<List>]
- (tree [rose #+ Tree])
- [stack #+ Stack]))
+ (lux (data (coll [list "" Monad<List> Fold<List> "List/" Monoid<List>]
+ (tree [rose #+ Tree])
+ [stack #+ Stack]))
[compiler]
(macro [ast]
["s" syntax #+ syntax: Syntax])))
diff --git a/stdlib/source/lux/data/struct/vector.lux b/stdlib/source/lux/data/coll/vector.lux
index 9a22efb93..1dbceb97e 100644
--- a/stdlib/source/lux/data/struct/vector.lux
+++ b/stdlib/source/lux/data/coll/vector.lux
@@ -12,8 +12,8 @@
monoid
fold)
(data maybe
- (struct [list "List/" Fold<List> Functor<List> Monoid<List>]
- [array #+ Array "Array/" Functor<Array> Fold<Array>])
+ (coll [list "List/" Fold<List> Functor<List> Monoid<List>]
+ [array #+ Array "Array/" Functor<Array> Fold<Array>])
[bit]
[number "Int/" Number<Int>]
[product])
@@ -255,7 +255,7 @@
(error! "Incorrect vector structure."))))
#;None)))
-(def: #export (at idx vec)
+(def: #export (nth idx vec)
(All [a] (-> Nat (Vector a) (Maybe a)))
(do Monad<Maybe>
[base (base-for idx vec)]
@@ -276,7 +276,7 @@
(def: #export (update idx f vec)
(All [a] (-> Nat (-> a a) (Vector a) (Vector a)))
- (case (at idx vec)
+ (case (nth idx vec)
(#;Some val)
(put idx (f val) vec)
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 66ad6c093..0c61b958b 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -21,9 +21,9 @@
[error #- fail]
[sum]
[product]
- (struct [list "" Fold<List> "List/" Monad<List>]
- [vector #+ Vector vector "Vector/" Monad<Vector>]
- [dict #+ Dict]))
+ (coll [list "" Fold<List> "List/" Monad<List>]
+ [vector #+ Vector vector "Vector/" Monad<Vector>]
+ [dict #+ Dict]))
(codata [function])
[compiler #+ Monad<Lux> with-gensyms]
(macro [syntax #+ syntax:]
@@ -544,13 +544,13 @@
_
(#;Left (format "JSON value is not an object: " (show-json json))))))
-(def: #export (at idx parser)
+(def: #export (nth idx parser)
{#;doc "Parses an element inside a JSON array."}
(All [a] (-> Nat (Parser a) (Parser a)))
(lambda [json]
(case json
(#Array values)
- (case (vector;at idx values)
+ (case (vector;nth idx values)
(#;Some value)
(case (parser value)
(#;Right output)
@@ -689,8 +689,8 @@
(and prev
(default false
(do Monad<Maybe>
- [x' (vector;at idx xs)
- y' (vector;at idx ys)]
+ [x' (vector;nth idx xs)
+ y' (vector;nth idx ys)]
(wrap (= x' y'))))))
true
(list;indices (vector;size xs))))
@@ -734,7 +734,7 @@
parsers (|> parts
(list;zip2 (list;indices array-size))
(List/map (lambda [[idx parser]]
- (` (at (~ (ast;nat idx)) (~ parser))))))]
+ (` (nth (~ (ast;nat idx)) (~ parser))))))]
(wrap (list (` ($_ seq (~@ parsers))))))
(#ObjectShape kvs)
@@ -757,7 +757,7 @@
parsers (|> parts
(list;zip2 (list;indices array-size))
(List/map (lambda [[idx parser]]
- (` (at (~ (ast;nat idx)) (~ parser))))))]
+ (` (nth (~ (ast;nat idx)) (~ parser))))))]
(wrap (list (` (ensure (array-size! (~ (ast;nat array-size)))
($_ seq (~@ parsers)))))))
@@ -998,8 +998,8 @@
[#let [tag (ast;tag name)]
decoder (Codec<JSON,?>//decode new-*env* :case:)]
(wrap (list (` (do Monad<Parser>
- [(~ g!_) (;;at +0 (;;text! (~ (ast;text (product;right name)))))
- (~ g!_) (;;at +1 (~ decoder))]
+ [(~ g!_) (;;nth +0 (;;text! (~ (ast;text (product;right name)))))
+ (~ g!_) (;;nth +1 (~ decoder))]
((~ (' wrap)) ((~ tag) (~ g!_)))))))))
members)
#let [:x:+ (case g!vars
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux
index 85d5d9dd5..adc0454b2 100644
--- a/stdlib/source/lux/data/text.lux
+++ b/stdlib/source/lux/data/text.lux
@@ -11,7 +11,7 @@
monad
codec
hash)
- (data (struct [list])
+ (data (coll [list])
maybe)))
## [Functions]
@@ -19,7 +19,7 @@
(-> Text Nat)
(int-to-nat (_lux_proc ["jvm" "i2l"] [(_lux_proc ["jvm" "invokevirtual:java.lang.String:length:"] [x])])))
-(def: #export (at idx x)
+(def: #export (nth idx x)
(-> Nat Text (Maybe Char))
(if (n.< (size x) idx)
(#;Some (_lux_proc ["jvm" "invokevirtual:java.lang.String:charAt:int"] [x (_lux_proc ["jvm" "l2i"] [(nat-to-int idx)])]))
diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux
index 2ae5c62ca..732de0db4 100644
--- a/stdlib/source/lux/data/text/format.lux
+++ b/stdlib/source/lux/data/text/format.lux
@@ -11,7 +11,7 @@
[number]
[text]
[ident]
- (struct [list "" Monad<List>]))
+ (coll [list "" Monad<List>]))
[type]
[compiler]
(macro [ast]
diff --git a/stdlib/source/lux/control/effect.lux b/stdlib/source/lux/effect.lux
index 2b81ad543..de3038927 100644
--- a/stdlib/source/lux/control/effect.lux
+++ b/stdlib/source/lux/effect.lux
@@ -8,8 +8,8 @@
(lux (control ["F" functor]
applicative
monad)
- (codata [io #- run])
- (data (struct [list "List/" Monad<List> Monoid<List>])
+ [io #- run]
+ (data (coll [list "List/" Monad<List> Monoid<List>])
[number "Nat/" Codec<Text,Nat>]
text/format
error
@@ -217,7 +217,7 @@
(def: translation^
(Syntax Translation)
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' =>))]
+ [_ (s;this! (' =>))]
(s;seq s;symbol
(s;tuple (s;seq s;any
s;any))))))
diff --git a/stdlib/source/lux/host.lux b/stdlib/source/lux/host.lux
index ededaa0a4..58d163c2e 100644
--- a/stdlib/source/lux/host.lux
+++ b/stdlib/source/lux/host.lux
@@ -7,10 +7,10 @@
lux
(lux (control monad
[enum])
- (codata function
- [io #+ IO Monad<IO> io])
- (data (struct [list #* "" Functor<List> Fold<List> "List/" Monad<List> Monoid<List>]
- [array #+ Array])
+ [io #+ IO Monad<IO> io]
+ (codata function)
+ (data (coll [list #* "" Functor<List> Fold<List> "List/" Monad<List> Monoid<List>]
+ [array #+ Array])
number
maybe
[product]
@@ -561,14 +561,14 @@
(-> Text Text (Syntax AST))
(do s;Monad<Syntax>
[#let [dotted-name (format "." field-name)]
- _ (s;sample! (ast;symbol ["" dotted-name]))]
+ _ (s;this! (ast;symbol ["" dotted-name]))]
(wrap (`' (_lux_proc ["jvm" (~ (ast;text (format "getstatic" ":" class-name ":" field-name)))] [])))))
(def: (make-get-var-parser class-name field-name)
(-> Text Text (Syntax AST))
(do s;Monad<Syntax>
[#let [dotted-name (format "." field-name)]
- _ (s;sample! (ast;symbol ["" dotted-name]))]
+ _ (s;this! (ast;symbol ["" dotted-name]))]
(wrap (`' (_lux_proc ["jvm" (~ (ast;text (format "getfield" ":" class-name ":" field-name)))] [_jvm_this])))))
(def: (make-put-var-parser class-name field-name)
@@ -576,7 +576,7 @@
(do s;Monad<Syntax>
[#let [dotted-name (format "." field-name)]
[_ _ value] (: (Syntax [Unit Unit AST])
- (s;form ($_ s;seq (s;sample! (' :=)) (s;sample! (ast;symbol ["" dotted-name])) s;any)))]
+ (s;form ($_ s;seq (s;this! (' :=)) (s;this! (ast;symbol ["" dotted-name])) s;any)))]
(wrap (`' (_lux_proc ["jvm" (~ (ast;text (format "putfield" ":" class-name ":" field-name)))] [_jvm_this (~ value)])))))
(def: (pre-walk-replace f input)
@@ -621,7 +621,7 @@
(-> (List TypeParam) Text (List ArgDecl) (Syntax AST))
(do s;Monad<Syntax>
[[_ args] (: (Syntax [Unit (List AST)])
- (s;form ($_ s;seq (s;sample! (' .new!)) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
+ (s;form ($_ s;seq (s;this! (' .new!)) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
#let [arg-decls' (: (List Text) (map (. (simple-class$ params) product;right) arg-decls))]]
(wrap (` (;_lux_proc ["jvm" (~ (ast;text (format "new" ":" class-name ":" (text;join-with "," arg-decls'))))]
[(~@ args)])))))
@@ -631,7 +631,7 @@
(do s;Monad<Syntax>
[#let [dotted-name (format "." method-name "!")]
[_ args] (: (Syntax [Unit (List AST)])
- (s;form ($_ s;seq (s;sample! (ast;symbol ["" dotted-name])) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
+ (s;form ($_ s;seq (s;this! (ast;symbol ["" dotted-name])) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
#let [arg-decls' (: (List Text) (map (. (simple-class$ params) product;right) arg-decls))]]
(wrap (`' (;_lux_proc ["jvm" (~ (ast;text (format "invokestatic" ":" class-name ":" method-name ":" (text;join-with "," arg-decls'))))]
[(~@ args)])))))
@@ -642,7 +642,7 @@
(do s;Monad<Syntax>
[#let [dotted-name (format "." method-name "!")]
[_ args] (: (Syntax [Unit (List AST)])
- (s;form ($_ s;seq (s;sample! (ast;symbol ["" dotted-name])) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
+ (s;form ($_ s;seq (s;this! (ast;symbol ["" dotted-name])) (s;tuple (s;exactly (list;size arg-decls) s;any)))))
#let [arg-decls' (: (List Text) (map (. (simple-class$ params) product;right) arg-decls))]]
(wrap (`' (;_lux_proc ["jvm" (~ (ast;text (format <jvm-op> ":" class-name ":" method-name ":" (text;join-with "," arg-decls'))))]
[(~' _jvm_this) (~@ args)])))))]
@@ -680,32 +680,32 @@
(Syntax PrivacyModifier)
(let [(^open) s;Monad<Syntax>]
($_ s;alt
- (s;sample! (' #public))
- (s;sample! (' #private))
- (s;sample! (' #protected))
+ (s;this! (' #public))
+ (s;this! (' #private))
+ (s;this! (' #protected))
(wrap []))))
(def: inheritance-modifier^
(Syntax InheritanceModifier)
(let [(^open) s;Monad<Syntax>]
($_ s;alt
- (s;sample! (' #final))
- (s;sample! (' #abstract))
+ (s;this! (' #final))
+ (s;this! (' #abstract))
(wrap []))))
(def: bound-kind^
(Syntax BoundKind)
- (s;alt (s;sample! (' <))
- (s;sample! (' >))))
+ (s;alt (s;this! (' <))
+ (s;this! (' >))))
(def: (generic-type^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax GenericType))
($_ s;either
(do s;Monad<Syntax>
- [_ (s;sample! (' ?))]
+ [_ (s;this! (' ?))]
(wrap (#GenericWildcard #;None)))
(s;tuple (do s;Monad<Syntax>
- [_ (s;sample! (' ?))
+ [_ (s;this! (' ?))
bound-kind bound-kind^
bound (generic-type^ imports type-vars)]
(wrap (#GenericWildcard (#;Some [bound-kind bound])))))
@@ -731,7 +731,7 @@
## else
(wrap (#GenericClass name (list))))))
(s;form (do s;Monad<Syntax>
- [name (s;sample! (' Array))
+ [name (s;this! (' Array))
component (generic-type^ imports type-vars)]
(case component
(^template [<class> <name>]
@@ -763,7 +763,7 @@
(wrap [param-name (list)]))
(s;tuple (do s;Monad<Syntax>
[param-name s;local-symbol
- _ (s;sample! (' <))
+ _ (s;this! (' <))
bounds (s;many (generic-type^ imports (list)))]
(wrap [param-name bounds])))))
@@ -807,7 +807,7 @@
(def: (annotations^' imports)
(-> ClassImports (Syntax (List Annotation)))
(do s;Monad<Syntax>
- [_ (s;sample! (' #ann))]
+ [_ (s;this! (' #ann))]
(s;tuple (s;some (annotation^ imports)))))
(def: (annotations^ imports)
@@ -819,7 +819,7 @@
(def: (throws-decl'^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax (List GenericType)))
(do s;Monad<Syntax>
- [_ (s;sample! (' #throws))]
+ [_ (s;this! (' #throws))]
(s;tuple (s;some (generic-type^ imports type-vars)))))
(def: (throws-decl^ imports type-vars)
@@ -845,14 +845,14 @@
(def: state-modifier^
(Syntax StateModifier)
($_ s;alt
- (s;sample! (' #volatile))
- (s;sample! (' #final))
+ (s;this! (' #volatile))
+ (s;this! (' #final))
(:: s;Monad<Syntax> wrap [])))
(def: (field-decl^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax [MemberDecl FieldDecl]))
(s;either (s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #const))
+ [_ (s;this! (' #const))
name s;local-symbol
anns (annotations^ imports)
type (generic-type^ imports type-vars)
@@ -887,10 +887,10 @@
(-> ClassImports (List TypeParam) (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
[pm privacy-modifier^
- strict-fp? (s;sample? (' #strict))
+ strict-fp? (s;this? (' #strict))
method-vars (s;default (list) (type-params^ imports))
#let [total-vars (List/append class-vars method-vars)]
- [_ arg-decls] (s;form (s;seq (s;sample! (' new))
+ [_ arg-decls] (s;form (s;seq (s;this! (' new))
(arg-decls^ imports total-vars)))
constructor-args (constructor-args^ imports total-vars)
exs (throws-decl^ imports total-vars)
@@ -905,8 +905,8 @@
(-> ClassImports (List TypeParam) (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
[pm privacy-modifier^
- strict-fp? (s;sample? (' #strict))
- final? (s;sample? (' #final))
+ strict-fp? (s;this? (' #strict))
+ final? (s;this? (' #final))
method-vars (s;default (list) (type-params^ imports))
#let [total-vars (List/append class-vars method-vars)]
[name arg-decls] (s;form (s;seq s;local-symbol
@@ -923,7 +923,7 @@
(def: (overriden-method-def^ imports)
(-> ClassImports (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
- [strict-fp? (s;sample? (' #strict))
+ [strict-fp? (s;this? (' #strict))
owner-class (class-decl^ imports)
method-vars (s;default (list) (type-params^ imports))
#let [total-vars (List/append (product;right owner-class) method-vars)]
@@ -942,8 +942,8 @@
(-> ClassImports (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
[pm privacy-modifier^
- strict-fp? (s;sample? (' #strict))
- _ (s;sample! (' #static))
+ strict-fp? (s;this? (' #strict))
+ _ (s;this! (' #static))
method-vars (s;default (list) (type-params^ imports))
#let [total-vars method-vars]
[name arg-decls] (s;form (s;seq s;local-symbol
@@ -961,7 +961,7 @@
(-> ClassImports (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
[pm privacy-modifier^
- _ (s;sample! (' #abstract))
+ _ (s;this! (' #abstract))
method-vars (s;default (list) (type-params^ imports))
#let [total-vars method-vars]
[name arg-decls] (s;form (s;seq s;local-symbol
@@ -978,7 +978,7 @@
(-> ClassImports (Syntax [MemberDecl MethodDef]))
(s;form (do s;Monad<Syntax>
[pm privacy-modifier^
- _ (s;sample! (' #native))
+ _ (s;this! (' #native))
method-vars (s;default (list) (type-params^ imports))
#let [total-vars method-vars]
[name arg-decls] (s;form (s;seq s;local-symbol
@@ -1008,42 +1008,42 @@
(def: class-kind^
(Syntax ClassKind)
(s;either (do s;Monad<Syntax>
- [_ (s;sample! (' #class))]
+ [_ (s;this! (' #class))]
(wrap #Class))
(do s;Monad<Syntax>
- [_ (s;sample! (' #interface))]
+ [_ (s;this! (' #interface))]
(wrap #Interface))
))
(def: import-member-alias^
(Syntax (Maybe Text))
(s;opt (do s;Monad<Syntax>
- [_ (s;sample! (' #as))]
+ [_ (s;this! (' #as))]
s;local-symbol)))
(def: (import-member-args^ imports type-vars)
(-> ClassImports (List TypeParam) (Syntax (List [Bool GenericType])))
- (s;tuple (s;some (s;seq (s;sample? (' #?)) (generic-type^ imports type-vars)))))
+ (s;tuple (s;some (s;seq (s;this? (' #?)) (generic-type^ imports type-vars)))))
(def: import-member-return-flags^
(Syntax [Bool Bool Bool])
- ($_ s;seq (s;sample? (' #io)) (s;sample? (' #try)) (s;sample? (' #?))))
+ ($_ s;seq (s;this? (' #io)) (s;this? (' #try)) (s;this? (' #?))))
(def: primitive-mode^
(Syntax Primitive-Mode)
- (s;alt (s;sample! (' #manual))
- (s;sample! (' #auto))))
+ (s;alt (s;this! (' #manual))
+ (s;this! (' #auto))))
(def: (import-member-decl^ imports owner-vars)
(-> ClassImports (List TypeParam) (Syntax ImportMemberDecl))
($_ s;either
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #enum))
+ [_ (s;this! (' #enum))
enum-members (s;some s;local-symbol)]
(wrap (#EnumDecl enum-members))))
(s;form (do s;Monad<Syntax>
[tvars (s;default (list) (type-params^ imports))
- _ (s;sample! (' new))
+ _ (s;this! (' new))
?alias import-member-alias^
#let [total-vars (List/append owner-vars tvars)]
?prim-mode (s;opt primitive-mode^)
@@ -1061,7 +1061,7 @@
))
(s;form (do s;Monad<Syntax>
[kind (: (Syntax ImportMethodKind)
- (s;alt (s;sample! (' #static))
+ (s;alt (s;this! (' #static))
(wrap [])))
tvars (s;default (list) (type-params^ imports))
name s;local-symbol
@@ -1083,12 +1083,12 @@
#import-method-return return
}]))))
(s;form (do s;Monad<Syntax>
- [static? (s;sample? (' #static))
+ [static? (s;this? (' #static))
name s;local-symbol
?prim-mode (s;opt primitive-mode^)
gtype (generic-type^ imports owner-vars)
- maybe? (s;sample? (' #?))
- setter? (s;sample? (' #!))]
+ maybe? (s;this? (' #?))
+ setter? (s;this? (' #!))]
(wrap (#FieldAccessDecl {#import-field-mode (default #AutoPrM ?prim-mode)
#import-field-name name
#import-field-static? static?
@@ -1251,7 +1251,7 @@
(#OverridenMethod strict-fp? class-decl type-vars arg-decls return-type body exs)
(let [super-replacer (parser->replacer (s;form (do s;Monad<Syntax>
- [_ (s;sample! (' .super!))
+ [_ (s;this! (' .super!))
args (s;tuple (s;exactly (list;size arg-decls) s;any))
#let [arg-decls' (: (List Text) (map (. (simple-class$ (list)) product;right)
arg-decls))]]
@@ -1944,7 +1944,7 @@
(compiler;fail (format "Unknown class: " class-name))))
(syntax: #export (jvm-import [#let [imports (class-imports *compiler*)]]
- [long-name? (s;sample? (' #long))]
+ [long-name? (s;this? (' #long))]
[class-decl (class-decl^ imports)]
[#let [full-class-name (product;left class-decl)
imports (add-import [(short-class-name full-class-name) full-class-name]
diff --git a/stdlib/source/lux/codata/io.lux b/stdlib/source/lux/io.lux
index 60ea73834..e395e7c32 100644
--- a/stdlib/source/lux/codata/io.lux
+++ b/stdlib/source/lux/io.lux
@@ -8,7 +8,7 @@
(lux (control functor
applicative
monad)
- (data (struct list))))
+ (data (coll list))))
## [Types]
(type: #export (IO a)
diff --git a/stdlib/source/lux/lexer.lux b/stdlib/source/lux/lexer.lux
index ca8f7f5cf..03e5f5cbd 100644
--- a/stdlib/source/lux/lexer.lux
+++ b/stdlib/source/lux/lexer.lux
@@ -15,7 +15,7 @@
[char "Char/" Ord<Char>]
maybe
["E" error #- fail]
- (struct [list "" Functor<List>]))))
+ (coll [list "" Functor<List>]))))
## [Types]
(type: #export (Lexer a)
@@ -86,7 +86,7 @@
{#;doc "Just returns the next character without applying any logic."}
(Lexer Char)
(lambda [input]
- (case [(text;at +0 input) (text;split +1 input)]
+ (case [(text;nth +0 input) (text;split +1 input)]
[(#;Some output) (#;Some [_ input'])]
(#E;Success [input' output])
@@ -276,7 +276,7 @@
{#;doc "Lex the next character (without consuming it from the input)."}
(Lexer Char)
(lambda [input]
- (case (text;at +0 input)
+ (case (text;nth +0 input)
(#;Some output)
(#E;Success [input output])
@@ -288,7 +288,7 @@
{#;doc "Lex a character if it matches the given sample."}
(-> Char (Lexer Char))
(lambda [input]
- (case [(text;at +0 input) (text;split +1 input)]
+ (case [(text;nth +0 input) (text;split +1 input)]
[(#;Some char') (#;Some [_ input'])]
(if (Char/= test char')
(#E;Success [input' test])
@@ -352,7 +352,7 @@
(case (text;split +1 input)
(#;Some [init input'])
(if (text;contains? init options)
- (case (text;at +0 init)
+ (case (text;nth +0 init)
(#;Some output)
(#E;Success [input' output])
@@ -370,7 +370,7 @@
(case (text;split +1 input)
(#;Some [init input'])
(if (;not (text;contains? init options))
- (case (text;at +0 init)
+ (case (text;nth +0 init)
(#;Some output)
(#E;Success [input' output])
@@ -388,7 +388,7 @@
(case (: (Maybe [Text Char])
(do Monad<Maybe>
[[init input'] (text;split +1 input)
- output (text;at +0 init)]
+ output (text;nth +0 init)]
(wrap [input' output])))
(#;Some [input' output])
(if (p output)
diff --git a/stdlib/source/lux/lexer/regex.lux b/stdlib/source/lux/lexer/regex.lux
index 5684a4465..503364ce0 100644
--- a/stdlib/source/lux/lexer/regex.lux
+++ b/stdlib/source/lux/lexer/regex.lux
@@ -11,7 +11,7 @@
text/format
[number "Int/" Codec<Text,Int>]
[product]
- (struct [list "" Fold<List> "List/" Monad<List>]))
+ (coll [list "" Fold<List> "List/" Monad<List>]))
[compiler #- run]
(macro [ast]
[syntax #+ syntax:])
diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux
index b06deedb7..54d41b28f 100644
--- a/stdlib/source/lux/macro.lux
+++ b/stdlib/source/lux/macro.lux
@@ -6,14 +6,14 @@
(;module:
lux
(lux (control monad)
- (data (struct [list "List/" Monad<List>])
+ (data (coll [list "List/" Monad<List>])
text/format)
[compiler]
(macro ["s" syntax #+ syntax: Syntax])))
(def: omit^
(Syntax Bool)
- (s;sample? (' #omit)))
+ (s;this? (' #omit)))
(do-template [<macro> <func>]
[(syntax: #export (<macro> [? omit^] token)
diff --git a/stdlib/source/lux/macro/ast.lux b/stdlib/source/lux/macro/ast.lux
index 821264c09..d284a8043 100644
--- a/stdlib/source/lux/macro/ast.lux
+++ b/stdlib/source/lux/macro/ast.lux
@@ -11,7 +11,7 @@
[char]
[text #+ Eq<Text> "Text/" Monoid<Text>]
ident
- (struct [list #* "" Functor<List> Fold<List>])
+ (coll [list #* "" Functor<List> Fold<List>])
)))
## [Types]
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index d194a540b..5420e0328 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -9,8 +9,8 @@
[eq])
(data [text]
text/format
- (struct [list "List/" Fold<List> Monad<List>]
- [dict #+ Dict])
+ (coll [list "List/" Fold<List> Monad<List>]
+ [dict #+ Dict])
[number]
[product]
[bool]
diff --git a/stdlib/source/lux/macro/poly/eq.lux b/stdlib/source/lux/macro/poly/eq.lux
index bdce71d50..a9d7c0fae 100644
--- a/stdlib/source/lux/macro/poly/eq.lux
+++ b/stdlib/source/lux/macro/poly/eq.lux
@@ -9,8 +9,8 @@
[eq])
(data [text]
text/format
- (struct [list "List/" Monad<List>]
- [dict #+ Dict])
+ (coll [list "List/" Monad<List>]
+ [dict #+ Dict])
[number]
[product]
[bool]
diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux
index e659bb41d..ec06193bf 100644
--- a/stdlib/source/lux/macro/poly/functor.lux
+++ b/stdlib/source/lux/macro/poly/functor.lux
@@ -9,8 +9,8 @@
[functor])
(data [text]
text/format
- (struct [list "List/" Monad<List>]
- [dict #+ Dict])
+ (coll [list "List/" Monad<List>]
+ [dict #+ Dict])
[number]
[product]
[bool]
diff --git a/stdlib/source/lux/macro/poly/text-encoder.lux b/stdlib/source/lux/macro/poly/text-encoder.lux
index c538844a7..c197f8e0c 100644
--- a/stdlib/source/lux/macro/poly/text-encoder.lux
+++ b/stdlib/source/lux/macro/poly/text-encoder.lux
@@ -9,8 +9,8 @@
[codec])
(data [text]
text/format
- (struct [list "List/" Monad<List>]
- [dict #+ Dict])
+ (coll [list "List/" Monad<List>]
+ [dict #+ Dict])
[number]
[product]
[bool]
diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux
index ba24b607b..2713de9c1 100644
--- a/stdlib/source/lux/macro/syntax.lux
+++ b/stdlib/source/lux/macro/syntax.lux
@@ -15,7 +15,7 @@
[number]
[text "Text/" Monoid<Text>]
[ident]
- (struct [list #* "" Functor<List> Fold<List> "List/" Monoid<List>])
+ (coll [list #* "" Functor<List> Fold<List> "List/" Monoid<List>])
[product]
[error #- fail]))
(.. [ast "AST/" Eq<AST>]))
@@ -113,7 +113,7 @@
[ tag Ident #;TagS ident;Eq<Ident> "tag"]
)
-(def: #export (sample? ast)
+(def: #export (this? ast)
{#;doc "Asks if the given AST is the next input."}
(-> AST (Syntax Bool))
(lambda [tokens]
@@ -128,7 +128,7 @@
_
(#;Right [tokens false]))))
-(def: #export (sample! ast)
+(def: #export (this! ast)
{#;doc "Ensures the given AST is the next input."}
(-> AST (Syntax Unit))
(lambda [tokens]
diff --git a/stdlib/source/lux/macro/syntax/common.lux b/stdlib/source/lux/macro/syntax/common.lux
index 96203b4c2..3ebb716c6 100644
--- a/stdlib/source/lux/macro/syntax/common.lux
+++ b/stdlib/source/lux/macro/syntax/common.lux
@@ -8,7 +8,7 @@
The goal is to be able to reuse common syntax in macro definitions across libraries."}
lux
(lux (control monad)
- (data (struct [list])
+ (data (coll [list])
text/format
[ident "Ident/" Eq<Ident>]
[product])
@@ -27,8 +27,8 @@
#export
#hidden)}
(Syntax (Maybe Export-Level))
- (s;opt (s;alt (s;sample! (' #export))
- (s;sample! (' #hidden)))))
+ (s;opt (s;alt (s;this! (' #export))
+ (s;this! (' #hidden)))))
(def: #export (gen-export-level ?el)
(-> (Maybe Export-Level) (List AST))
@@ -70,7 +70,7 @@
(def: check^
(Syntax [(Maybe AST) AST])
(s;either (s;form (do s;Monad<Syntax>
- [_ (s;sample! (' lux;_lux_:))
+ [_ (s;this! (' lux;_lux_:))
type s;any
value s;any]
(wrap [(#;Some type) value])))
@@ -83,9 +83,9 @@
(def: (_def-anns^ _)
(-> Top (Syntax (List [Ident AST])))
- (s;alt (s;sample! (' #lux;Nil))
+ (s;alt (s;this! (' #lux;Nil))
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #lux;Cons))
+ [_ (s;this! (' #lux;Cons))
[head tail] (s;seq (s;tuple (s;seq _def-anns-tag^ s;any))
(_def-anns^ []))]
(wrap [head tail])))
@@ -94,10 +94,10 @@
(def: (flat-list^ _)
(-> Top (Syntax (List AST)))
(s;either (do s;Monad<Syntax>
- [_ (s;sample! (' #lux;Nil))]
+ [_ (s;this! (' #lux;Nil))]
(wrap (list)))
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #lux;Cons))
+ [_ (s;this! (' #lux;Cons))
[head tail] (s;tuple (s;seq s;any s;any))
tail (s;local (list tail) (flat-list^ []))]
(wrap (#;Cons head tail))))))
@@ -105,13 +105,13 @@
(def: list-meta^
(Syntax (List AST))
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #lux;ListA))]
+ [_ (s;this! (' #lux;ListA))]
(flat-list^ []))))
(def: text-meta^
(Syntax Text)
(s;form (do s;Monad<Syntax>
- [_ (s;sample! (' #lux;TextA))]
+ [_ (s;this! (' #lux;TextA))]
s;text)))
(def: (find-def-args meta-data)
@@ -138,7 +138,7 @@
(compiler;macro-expand-all def-raw))]
(s;local me-def-raw
(s;form (do @
- [_ (s;sample! (' lux;_lux_def))
+ [_ (s;this! (' lux;_lux_def))
def-name s;local-symbol
[?def-type def-value] check^
def-anns s;any
diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux
index d5a03b421..1fdde77e6 100644
--- a/stdlib/source/lux/math.lux
+++ b/stdlib/source/lux/math.lux
@@ -6,7 +6,7 @@
(;module: {#;doc "Common mathematical constants and functions."}
lux
(lux (control monad)
- (data (struct [list "" Fold<List>])
+ (data (coll [list "" Fold<List>])
[number "Int/" Number<Int>]
[product]
text/format)
@@ -122,7 +122,7 @@
(s/map ast;tag s;tag))
(s;form (s;many s;any))
(s;tuple (s;either (do s;Monad<Syntax>
- [_ (s;sample! (' #and))
+ [_ (s;this! (' #and))
init-subject (infix^ [])
init-op s;any
init-param (infix^ [])
diff --git a/stdlib/source/lux/math/complex.lux b/stdlib/source/lux/math/complex.lux
index 9666abdab..ef91715ad 100644
--- a/stdlib/source/lux/math/complex.lux
+++ b/stdlib/source/lux/math/complex.lux
@@ -16,7 +16,7 @@
text/format
error
maybe
- (struct [list "List/" Monad<List>]))
+ (coll [list "List/" Monad<List>]))
[compiler]
(macro [ast]
["s" syntax #+ syntax: Syntax])))
diff --git a/stdlib/source/lux/math/simple.lux b/stdlib/source/lux/math/simple.lux
index f8b059794..45ba0a4a4 100644
--- a/stdlib/source/lux/math/simple.lux
+++ b/stdlib/source/lux/math/simple.lux
@@ -8,7 +8,7 @@
(lux (control monad)
(data text/format
[product]
- (struct [list]))
+ (coll [list]))
[compiler]
(macro [ast]
["s" syntax #+ syntax: Syntax])
diff --git a/stdlib/source/lux/pipe.lux b/stdlib/source/lux/pipe.lux
index 12337e3ef..2008971c4 100644
--- a/stdlib/source/lux/pipe.lux
+++ b/stdlib/source/lux/pipe.lux
@@ -6,7 +6,7 @@
(;module: {#;doc "Composable extensions to the piping macro |> that enhance it with various abilities."}
lux
(lux (control monad)
- (data (struct [list #+ Monad<List> "" Fold<List> "List/" Monad<List>])
+ (data (coll [list #+ Monad<List> "" Fold<List> "List/" Monad<List>])
maybe)
[compiler #+ with-gensyms Monad<Lux>]
(macro ["s" syntax #+ syntax: Syntax]
diff --git a/stdlib/source/lux/random.lux b/stdlib/source/lux/random.lux
index 195255643..468b6a34b 100644
--- a/stdlib/source/lux/random.lux
+++ b/stdlib/source/lux/random.lux
@@ -15,13 +15,13 @@
text/format
[product]
[number]
- (struct [list "List/" Fold<List>]
- ["A" array]
- ["D" dict]
- ["Q" queue]
- ["S" set]
- ["ST" stack]
- ["V" vector]))
+ (coll [list "List/" Fold<List>]
+ ["A" array]
+ ["D" dict]
+ ["Q" queue]
+ ["S" set]
+ ["ST" stack]
+ ["V" vector]))
(math ["r" ratio]
["c" complex])))
@@ -288,7 +288,7 @@
(def: (swap from to vec)
(All [a] (-> Nat Nat (V;Vector a) (V;Vector a)))
(V;put to (default (undefined)
- (V;at from vec))
+ (V;nth from vec))
vec))
(def: #export (shuffle seed vector)
diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux
index 9524a2168..3b582815e 100644
--- a/stdlib/source/lux/test.lux
+++ b/stdlib/source/lux/test.lux
@@ -12,12 +12,12 @@
applicative
monad)
(concurrency [promise #+ Promise Monad<Promise>])
- (data (struct [list "List/" Monad<List> Fold<List>])
+ (data (coll [list "List/" Monad<List> Fold<List>])
[product]
[text]
text/format
[error #- fail "Error/" Monad<Error>])
- (codata [io #- run])
+ [io #- run]
["R" random]
[host #- try]))
@@ -136,10 +136,10 @@
(def: config^
(Syntax Test-Config)
(s;alt (do s;Monad<Syntax>
- [_ (s;sample! (' #seed))]
+ [_ (s;this! (' #seed))]
s;nat)
(do s;Monad<Syntax>
- [_ (s;sample! (' #times))]
+ [_ (s;this! (' #times))]
s;nat)))
(def: property-test^
diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux
index cda44670b..7610773b1 100644
--- a/stdlib/source/lux/type.lux
+++ b/stdlib/source/lux/type.lux
@@ -11,7 +11,7 @@
[ident "Ident/" Eq<Ident>]
[number "Nat/" Codec<Text,Nat>]
maybe
- (struct [list #+ "List/" Monad<List> Monoid<List> Fold<List>]))
+ (coll [list #+ "List/" Monad<List> Monoid<List> Fold<List>]))
(macro [ast])
))
@@ -41,7 +41,7 @@
(#;BoundT idx)
(default (error! (Text/append "Unknown type var: " (Nat/encode idx)))
- (list;at idx env))
+ (list;nth idx env))
_
type
diff --git a/stdlib/source/lux/type/auto.lux b/stdlib/source/lux/type/auto.lux
index 2266827c9..28ba34090 100644
--- a/stdlib/source/lux/type/auto.lux
+++ b/stdlib/source/lux/type/auto.lux
@@ -10,8 +10,8 @@
(data [text "Text/" Eq<Text>]
text/format
[number]
- (struct [list "List/" Monad<List> Fold<List>]
- [dict])
+ (coll [list "List/" Monad<List> Fold<List>]
+ [dict])
[bool]
[product])
[compiler #+ Monad<Lux>]
diff --git a/stdlib/source/lux/type/check.lux b/stdlib/source/lux/type/check.lux
index 25cf19834..78461f7d7 100644
--- a/stdlib/source/lux/type/check.lux
+++ b/stdlib/source/lux/type/check.lux
@@ -15,8 +15,8 @@
[number]
maybe
[product]
- (struct [list]
- [dict])
+ (coll [list]
+ [dict])
[error #- fail])
[type "Type/" Eq<Type>]
))