aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux14
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux30
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux198
-rw-r--r--stdlib/source/library/lux/data/collection/queue.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/stack.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/tree.lux7
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux38
-rw-r--r--stdlib/source/library/lux/data/format/css/font.lux12
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux14
-rw-r--r--stdlib/source/library/lux/data/maybe.lux4
-rw-r--r--stdlib/source/library/lux/data/sum.lux20
-rw-r--r--stdlib/source/library/lux/data/text.lux4
18 files changed, 193 insertions, 190 deletions
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index ac34275aa..c1b5cd7bc 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -22,7 +22,7 @@
(type: #export (Array a)
{#.doc "Mutable arrays."}
- (#.Primitive ..type_name (#.Cons a #.Nil)))
+ (#.Primitive ..type_name (#.Item a #.End)))
(with_expansions [<index_type> (primitive "java.lang.Long")
<elem_type> (primitive "java.lang.Object")
@@ -279,13 +279,13 @@
(def: #export (to_list array)
(All [a] (-> (Array a) (List a)))
(loop [idx (dec (size array))
- output #.Nil]
+ output #.End]
(if (n.= ..underflow idx)
output
(recur (dec idx)
(case (read idx array)
(#.Some head)
- (#.Cons head output)
+ (#.Item head output)
#.None
output)))))
@@ -293,11 +293,11 @@
(def: #export (to_list' default array)
(All [a] (-> a (Array a) (List a)))
(loop [idx (dec (size array))
- output #.Nil]
+ output #.End]
(if (n.= ..underflow idx)
output
(recur (dec idx)
- (#.Cons (maybe.default default (read idx array))
+ (#.Item (maybe.default default (read idx array))
output)))))
(implementation: #export (equivalence (^open ",\."))
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index 490f3f3e0..81ad72fbd 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -533,7 +533,7 @@
(case node
(#Hierarchy _size hierarchy)
(array\fold (function (_ sub_node tail) (list\compose (entries' sub_node) tail))
- #.Nil
+ #.End
hierarchy)
(#Base bitmap base)
@@ -543,13 +543,13 @@
(list\compose (entries' sub_node) tail)
(#.Right [key' val'])
- (#.Cons [key' val'] tail)))
- #.Nil
+ (#.Item [key' val'] tail)))
+ #.End
base)
(#Collisions hash colls)
- (array\fold (function (_ [key' val'] tail) (#.Cons [key' val'] tail))
- #.Nil
+ (array\fold (function (_ [key' val'] tail) (#.Item [key' val'] tail))
+ #.End
colls)))
(type: #export (Dictionary k v)
@@ -639,8 +639,8 @@
(All [k v] (-> (Dictionary k v) (List <side>)))
(|>> ..entries
(list\fold (function (_ [k v] bundle)
- (#.Cons <side> bundle))
- #.Nil)))]
+ (#.Item <side> bundle))
+ #.End)))]
[keys k]
[values v]
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index cb187b477..fcac55d8a 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -572,10 +572,10 @@
(loop [entriesR (entries reference)
entriesS (entries sample)]
(case [entriesR entriesS]
- [#.Nil #.Nil]
+ [#.End #.End]
#1
- [(#.Cons [keyR valueR] entriesR') (#.Cons [keyS valueS] entriesS')]
+ [(#.Item [keyR valueR] entriesR') (#.Item [keyS valueS] entriesS')]
(and (/\= keyR keyS)
(,\= valueR valueS)
(recur entriesR' entriesS'))
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index f3f51c779..ac7cbcf6f 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -17,7 +17,7 @@
(def: #export empty
PList
- #.Nil)
+ #.End)
(def: #export size
(All [a] (-> (PList a) Nat))
@@ -30,10 +30,10 @@
(def: #export (get key properties)
(All [a] (-> Text (PList a) (Maybe a)))
(case properties
- #.Nil
+ #.End
#.None
- (#.Cons [k' v'] properties')
+ (#.Item [k' v'] properties')
(if (text\= key k')
(#.Some v')
(get key properties'))))
@@ -59,37 +59,37 @@
(def: #export (put key val properties)
(All [a] (-> Text a (PList a) (PList a)))
(case properties
- #.Nil
+ #.End
(list [key val])
- (#.Cons [k' v'] properties')
+ (#.Item [k' v'] properties')
(if (text\= key k')
- (#.Cons [key val]
+ (#.Item [key val]
properties')
- (#.Cons [k' v']
+ (#.Item [k' v']
(put key val properties')))))
(def: #export (update key f properties)
(All [a] (-> Text (-> a a) (PList a) (PList a)))
(case properties
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons [k' v'] properties')
+ (#.Item [k' v'] properties')
(if (text\= key k')
- (#.Cons [k' (f v')] properties')
- (#.Cons [k' v'] (update key f properties')))))
+ (#.Item [k' (f v')] properties')
+ (#.Item [k' v'] (update key f properties')))))
(def: #export (remove key properties)
(All [a] (-> Text (PList a) (PList a)))
(case properties
- #.Nil
+ #.End
properties
- (#.Cons [k' v'] properties')
+ (#.Item [k' v'] properties')
(if (text\= key k')
properties'
- (#.Cons [k' v']
+ (#.Item [k' v']
(remove key properties')))))
(def: #export equivalence
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index e1661f1a4..feaebb373 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -20,60 +20,60 @@
["n" nat]]]]])
## (type: (List a)
-## #Nil
-## (#Cons a (List a)))
+## #End
+## (#Item a (List a)))
(implementation: #export fold
(Fold List)
(def: (fold f init xs)
(case xs
- #.Nil
+ #.End
init
- (#.Cons x xs')
+ (#.Item x xs')
(fold f (f x init) xs'))))
(def: #export (folds f init inputs)
(All [a b] (-> (-> a b b) b (List a) (List b)))
(case inputs
- #.Nil
+ #.End
(list init)
- (#.Cons [head tail])
- (#.Cons [init (folds f (f head init) tail)])))
+ (#.Item [head tail])
+ (#.Item [init (folds f (f head init) tail)])))
(def: #export (reverse xs)
(All [a]
(-> (List a) (List a)))
- (fold (function (_ head tail) (#.Cons head tail))
- #.Nil
+ (fold (function (_ head tail) (#.Item head tail))
+ #.End
xs))
(def: #export (only keep? xs)
(All [a]
(-> (Predicate a) (List a) (List a)))
(case xs
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons x xs')
+ (#.Item x xs')
(if (keep? x)
- (#.Cons x (only keep? xs'))
+ (#.Item x (only keep? xs'))
(only keep? xs'))))
(def: #export (partition satisfies? list)
{#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."}
(All [a] (-> (Predicate a) (List a) [(List a) (List a)]))
(case list
- #.Nil
- [#.Nil #.Nil]
+ #.End
+ [#.End #.End]
- (#.Cons head tail)
+ (#.Item head tail)
(let [[in out] (partition satisfies? tail)]
(if (satisfies? head)
- [(#.Cons head in) out]
- [in (#.Cons head out)]))))
+ [(#.Item head in) out]
+ [in (#.Item head out)]))))
(def: #export (as_pairs xs)
{#.doc (doc "Cut the list into pairs of 2."
@@ -81,10 +81,10 @@
(All [a] (-> (List a) (List [a a])))
(case xs
(^ (list& x1 x2 xs'))
- (#.Cons [x1 x2] (as_pairs xs'))
+ (#.Item [x1 x2] (as_pairs xs'))
_
- #.Nil))
+ #.End))
(template [<name> <then> <else>]
[(def: #export (<name> n xs)
@@ -92,14 +92,14 @@
(-> Nat (List a) (List a)))
(if (n.> 0 n)
(case xs
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons x xs')
+ (#.Item x xs')
<then>)
<else>))]
- [take (#.Cons x (take (dec n) xs')) #.Nil]
+ [take (#.Item x (take (dec n) xs')) #.End]
[drop (drop (dec n) xs') xs]
)
@@ -108,15 +108,15 @@
(All [a]
(-> (Predicate a) (List a) (List a)))
(case xs
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons x xs')
+ (#.Item x xs')
(if (predicate x)
<then>
<else>)))]
- [take_while (#.Cons x (take_while predicate xs')) #.Nil]
+ [take_while (#.Item x (take_while predicate xs')) #.End]
[drop_while (drop_while predicate xs') xs]
)
@@ -125,58 +125,58 @@
(-> Nat (List a) [(List a) (List a)]))
(if (n.> 0 n)
(case xs
- #.Nil
- [#.Nil #.Nil]
+ #.End
+ [#.End #.End]
- (#.Cons x xs')
+ (#.Item x xs')
(let [[tail rest] (split (dec n) xs')]
- [(#.Cons x tail) rest]))
- [#.Nil xs]))
+ [(#.Item x tail) rest]))
+ [#.End xs]))
(def: (split_with' predicate ys xs)
(All [a]
(-> (Predicate a) (List a) (List a) [(List a) (List a)]))
(case xs
- #.Nil
+ #.End
[ys xs]
- (#.Cons x xs')
+ (#.Item x xs')
(if (predicate x)
- (split_with' predicate (#.Cons x ys) xs')
+ (split_with' predicate (#.Item x ys) xs')
[ys xs])))
(def: #export (split_with predicate xs)
{#.doc "Segment the list by using a predicate to tell when to cut."}
(All [a]
(-> (Predicate a) (List a) [(List a) (List a)]))
- (let [[ys' xs'] (split_with' predicate #.Nil xs)]
+ (let [[ys' xs'] (split_with' predicate #.End xs)]
[(reverse ys') xs']))
(def: #export (chunk n xs)
{#.doc "Segment the list in chunks of size N."}
(All [a] (-> Nat (List a) (List (List a))))
(case xs
- #.Nil
+ #.End
(list)
_
(let [[pre post] (split n xs)]
- (#.Cons pre (chunk n post)))))
+ (#.Item pre (chunk n post)))))
(def: #export (repeat n x)
{#.doc "A list of the value x, repeated n times."}
(All [a]
(-> Nat a (List a)))
(if (n.> 0 n)
- (#.Cons x (repeat (dec n) x))
- #.Nil))
+ (#.Item x (repeat (dec n) x))
+ #.End))
(def: (iterate' f x)
(All [a]
(-> (-> a (Maybe a)) a (List a)))
(case (f x)
(#.Some x')
- (#.Cons x (iterate' f x'))
+ (#.Item x (iterate' f x'))
#.None
(list)))
@@ -187,7 +187,7 @@
(-> (-> a (Maybe a)) a (List a)))
(case (f x)
(#.Some x')
- (#.Cons x (iterate' f x'))
+ (#.Item x (iterate' f x'))
#.None
(list x)))
@@ -196,10 +196,10 @@
(All [a b]
(-> (-> a (Maybe b)) (List a) (Maybe b)))
(case xs
- #.Nil
+ #.End
#.None
- (#.Cons x xs')
+ (#.Item x xs')
(case (check x)
(#.Some output)
(#.Some output)
@@ -215,20 +215,20 @@
(fold (function (_ head tail)
(case (check head)
(#.Some head)
- (#.Cons head tail)
+ (#.Item head tail)
#.None
tail))
- #.Nil
+ #.End
(reverse xs))}
(case xs
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons x xs')
+ (#.Item x xs')
(case (check x)
(#.Some output)
- (#.Cons output (all check xs'))
+ (#.Item output (all check xs'))
#.None
(all check xs')))))
@@ -248,13 +248,13 @@
(All [a]
(-> a (List a) (List a)))
(case xs
- #.Nil
+ #.End
xs
- (#.Cons x #.Nil)
+ (#.Item x #.End)
xs
- (#.Cons x xs')
+ (#.Item x xs')
(list& x sep (interpose sep xs'))))
(def: #export (size list)
@@ -267,10 +267,10 @@
(-> (Predicate a) (List a) Bit))
(loop [xs xs]
(case xs
- #.Nil
+ #.End
<init>
- (#.Cons x xs')
+ (#.Item x xs')
(case (predicate x)
<init>
(recur xs')
@@ -287,10 +287,10 @@
(All [a]
(-> Nat (List a) (Maybe a)))
(case xs
- #.Nil
+ #.End
#.None
- (#.Cons x xs')
+ (#.Item x xs')
(if (n.= 0 i)
(#.Some x)
(nth (dec i) xs'))))
@@ -300,10 +300,10 @@
(def: (= xs ys)
(case [xs ys]
- [#.Nil #.Nil]
+ [#.End #.End]
#1
- [(#.Cons x xs') (#.Cons y ys')]
+ [(#.Item x xs') (#.Item y ys')]
(and (\ Equivalence<a> = x y)
(= xs' ys'))
@@ -326,14 +326,14 @@
(implementation: #export monoid
(All [a] (Monoid (List a)))
- (def: identity #.Nil)
+ (def: identity #.End)
(def: (compose xs ys)
(case xs
- #.Nil
+ #.End
ys
- (#.Cons x xs')
- (#.Cons x (compose xs' ys)))))
+ (#.Item x xs')
+ (#.Item x (compose xs' ys)))))
(open: "." ..monoid)
@@ -342,11 +342,11 @@
(def: (map f ma)
(case ma
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons a ma')
- (#.Cons (f a) (map f ma')))))
+ (#.Item a ma')
+ (#.Item (f a) (map f ma')))))
(open: "." ..functor)
@@ -357,10 +357,10 @@
(def: (apply ff fa)
(case ff
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons f ff')
+ (#.Item f ff')
(compose (map f fa) (apply ff' fa)))))
(implementation: #export monad
@@ -369,21 +369,21 @@
(def: &functor ..functor)
(def: (in a)
- (#.Cons a #.Nil))
+ (#.Item a #.End))
(def: join (|>> reverse (fold compose identity))))
(def: #export (sort < xs)
(All [a] (-> (-> a a Bit) (List a) (List a)))
(case xs
- #.Nil
+ #.End
(list)
- (#.Cons x xs')
+ (#.Item x xs')
(let [[pre post] (fold (function (_ x' [pre post])
(if (< x x')
- [(#.Cons x' pre) post]
- [pre (#.Cons x' post)]))
+ [(#.Item x' pre) post]
+ [pre (#.Item x' post)]))
[(list) (list)]
xs')]
($_ compose (sort < pre) (list x) (sort < post)))))
@@ -391,7 +391,7 @@
(def: #export (empty? xs)
(All [a] (Predicate (List a)))
(case xs
- #.Nil
+ #.End
true
_
@@ -400,10 +400,10 @@
(def: #export (member? eq xs x)
(All [a] (-> (Equivalence a) (List a) a Bit))
(case xs
- #.Nil
+ #.End
#0
- (#.Cons x' xs')
+ (#.Item x' xs')
(or (\ eq = x x')
(member? eq xs' x))))
@@ -412,10 +412,10 @@
{#.doc <doc>}
(All [a] (-> (List a) (Maybe <output>)))
(case xs
- #.Nil
+ #.End
#.None
- (#.Cons x xs')
+ (#.Item x xs')
(#.Some <side>)))]
[head a x "Returns the first element of a list."]
@@ -476,7 +476,7 @@
(let [base (nat@encode idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
- pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs))))
+ pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
vars+lists))])
g!step (identifier$ "0step0")
g!blank (identifier$ "0,0")
@@ -485,11 +485,11 @@
(function ((~ g!step) (~+ list_vars))
(case [(~+ list_vars)]
(~ pattern)
- (#.Cons [(~+ (map product.left vars+lists))]
+ (#.Item [(~+ (map product.left vars+lists))]
((~ g!step) (~+ list_vars)))
(~ g!blank)
- #.Nil))))]
+ #.End))))]
(#.Right [state (list code)]))
(#.Left "Cannot zipped 0 lists."))
@@ -523,7 +523,7 @@
(let [base (nat@encode idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
- pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs))))
+ pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
vars+lists))])
g!step (identifier$ "0step0")
g!blank (identifier$ "0,0")
@@ -532,11 +532,11 @@
(function ((~ g!step) (~ g!func) (~+ list_vars))
(case [(~+ list_vars)]
(~ pattern)
- (#.Cons ((~ g!func) (~+ (map product.left vars+lists)))
+ (#.Item ((~ g!func) (~+ (map product.left vars+lists)))
((~ g!step) (~ g!func) (~+ list_vars)))
(~ g!blank)
- #.Nil))))]
+ #.End))))]
(#.Right [state (list code)]))
(#.Left "Cannot zipped_with 0 lists."))
@@ -549,13 +549,13 @@
(def: #export (last xs)
(All [a] (-> (List a) (Maybe a)))
(case xs
- #.Nil
+ #.End
#.None
- (#.Cons x #.Nil)
+ (#.Item x #.End)
(#.Some x)
- (#.Cons x xs')
+ (#.Item x xs')
(last xs')))
(def: #export (inits xs)
@@ -563,19 +563,19 @@
"Empty lists will result in a #.None value being returned instead.")}
(All [a] (-> (List a) (Maybe (List a))))
(case xs
- #.Nil
+ #.End
#.None
- (#.Cons x #.Nil)
- (#.Some #.Nil)
+ (#.Item x #.End)
+ (#.Some #.End)
- (#.Cons x xs')
+ (#.Item x xs')
(case (inits xs')
#.None
(undefined)
(#.Some tail)
- (#.Some (#.Cons x tail)))
+ (#.Some (#.Item x tail)))
))
(def: #export (concat xss)
@@ -609,8 +609,8 @@
(loop [idx 0
xs xs]
(case xs
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons x xs')
- (#.Cons [idx x] (recur (inc idx) xs')))))
+ (#.Item x xs')
+ (#.Item [idx x] (recur (inc idx) xs')))))
diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux
index e107fd98d..5fc4b333d 100644
--- a/stdlib/source/library/lux/data/collection/queue.lux
+++ b/stdlib/source/library/lux/data/collection/queue.lux
@@ -71,11 +71,11 @@
(def: #export (push val queue)
(All [a] (-> a (Queue a) (Queue a)))
(case (get@ #front queue)
- #.Nil
+ #.End
(set@ #front (list val) queue)
_
- (update@ #rear (|>> (#.Cons val)) queue)))
+ (update@ #rear (|>> (#.Item val)) queue)))
(implementation: #export (equivalence super)
(All [a] (-> (Equivalence a) (Equivalence (Queue a))))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index 6447d96fe..a53c7fb0e 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -180,7 +180,7 @@
array.to_list
list.reverse
(list\fold (function (_ sub acc) (list\compose (to_list' sub) acc))
- #.Nil))))
+ #.End))))
(type: #export (Row a)
{#level Level
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 3fe88a087..d36ca16c4 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -43,10 +43,10 @@
(loop [head start
tail next]
(//.pending [head (case tail
- #.Nil
+ #.End
(recur start next)
- (#.Cons head' tail')
+ (#.Item head' tail')
(recur head' tail'))])))
(template [<name> <return>]
@@ -89,7 +89,7 @@
(let [[x xs'] (//.run xs)]
(if <pred_test>
(let [[tail next] (<splitter> <pred_step> xs')]
- [(#.Cons [x tail]) next])
+ [(#.Item [x tail]) next])
[(list) xs])))]
[take_while drop_while split_while (-> a Bit) (pred x) pred]
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index c078c4df1..14ee02181 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -63,7 +63,7 @@
dictionary.entries
(list\fold (function (_ [elem multiplicity] output)
(list\compose (list.repeat multiplicity elem) output))
- #.Nil)))
+ #.End)))
(template [<name> <compose>]
[(def: #export (<name> parameter subject)
diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux
index c81240c29..53b608c2c 100644
--- a/stdlib/source/library/lux/data/collection/stack.lux
+++ b/stdlib/source/library/lux/data/collection/stack.lux
@@ -28,24 +28,24 @@
(def: #export (peek stack)
(All [a] (-> (Stack a) (Maybe a)))
(case (:representation stack)
- #.Nil
+ #.End
#.None
- (#.Cons value _)
+ (#.Item value _)
(#.Some value)))
(def: #export (pop stack)
(All [a] (-> (Stack a) (Maybe [a (Stack a)])))
(case (:representation stack)
- #.Nil
+ #.End
#.None
- (#.Cons top stack')
+ (#.Item top stack')
(#.Some [top (:abstraction stack')])))
(def: #export (push value stack)
(All [a] (-> a (Stack a) (Stack a)))
- (:abstraction (#.Cons value (:representation stack))))
+ (:abstraction (#.Item value (:representation stack))))
(implementation: #export (equivalence super)
(All [a]
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux
index 444ab32e2..7a14946c5 100644
--- a/stdlib/source/library/lux/data/collection/tree.lux
+++ b/stdlib/source/library/lux/data/collection/tree.lux
@@ -22,8 +22,11 @@
(def: #export (flatten tree)
(All [a] (-> (Tree a) (List a)))
- (#.Cons (get@ #value tree)
- (list\join (list\map flatten (get@ #children tree)))))
+ (|> tree
+ (get@ #children)
+ (list\map flatten)
+ list\join
+ (#.Item (get@ #value tree))))
(def: #export (leaf value)
(All [a] (-> a (Tree a)))
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 9803124a4..998b75c3e 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -86,12 +86,12 @@
(def: #export (down zipper)
(All [a] (-> (Zipper a) (Maybe (Zipper a))))
(case (..children zipper)
- #.Nil
+ #.End
#.None
- (#.Cons head tail)
+ (#.Item head tail)
(#.Some {#family (#.Some {#parent (set@ [#node #//.children] (list) zipper)
- #lefts #.Nil
+ #lefts #.End
#rights tail})
#node head})))
@@ -103,12 +103,12 @@
(for {@.old
(update@ #node (: (-> (Tree ($ 0)) (Tree ($ 0)))
(set@ #//.children (list\compose (list.reverse lefts)
- (#.Cons (get@ #node zipper)
+ (#.Item (get@ #node zipper)
rights))))
parent)}
(set@ [#node #//.children]
(list\compose (list.reverse lefts)
- (#.Cons (get@ #node zipper)
+ (#.Item (get@ #node zipper)
rights))
parent))))))
@@ -118,20 +118,20 @@
(case (get@ #family zipper)
(#.Some family)
(case (get@ <side> family)
- (#.Cons next side')
+ (#.Item next side')
(#.Some (for {@.old
{#family (#.Some (|> family
(set@ <side> side')
- (update@ <op_side> (|>> (#.Cons (get@ #node zipper))))))
+ (update@ <op_side> (|>> (#.Item (get@ #node zipper))))))
#node next}}
(let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a)))
(function (_ side' zipper)
(|>> (set@ <side> side')
- (update@ <op_side> (|>> (#.Cons (get@ #node zipper)))))))]
+ (update@ <op_side> (|>> (#.Item (get@ #node zipper)))))))]
{#family (#.Some (move side' zipper family))
#node next})))
- #.Nil
+ #.End
#.None)
#.None
@@ -145,19 +145,19 @@
(#.Some family)
(case (list.reverse (get@ <side> family))
- #.Nil
+ #.End
#.None
- (#.Cons last prevs)
+ (#.Item last prevs)
(#.Some (for {@.old {#family (#.Some (|> family
- (set@ <side> #.Nil)
- (update@ <op_side> (|>> (#.Cons (get@ #node zipper))
+ (set@ <side> #.End)
+ (update@ <op_side> (|>> (#.Item (get@ #node zipper))
(list\compose prevs)))))
#node last}}
(let [move (: (All [a] (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a)))
(function (_ prevs zipper)
- (|>> (set@ <side> #.Nil)
- (update@ <op_side> (|>> (#.Cons (get@ #node zipper))
+ (|>> (set@ <side> #.End)
+ (update@ <op_side> (|>> (#.Item (get@ #node zipper))
(list\compose prevs))))))]
{#family (#.Some (move prevs zipper family))
#node last}))))))]
@@ -249,7 +249,7 @@
(def: #export (adopt value zipper)
(All [a] (-> a (Zipper a) (Zipper a)))
(update@ [#node #//.children]
- (|>> (#.Cons (//.leaf value)))
+ (|>> (#.Item (//.leaf value)))
zipper))
(def: #export (remove zipper)
@@ -257,12 +257,12 @@
(do maybe.monad
[family (get@ #family zipper)]
(case (get@ #lefts family)
- #.Nil
+ #.End
(in (set@ [#node #//.children]
(get@ #rights family)
(get@ #parent family)))
- (#.Cons next side)
+ (#.Item next side)
(in (|> zipper
(set@ #family (|> family
(set@ #lefts side)
@@ -278,7 +278,7 @@
(#.Some family)
(#.Some (set@ #family
- (#.Some (update@ <side> (|>> (#.Cons (//.leaf value))) family))
+ (#.Some (update@ <side> (|>> (#.Item (//.leaf value))) family))
zipper))))]
[insert_left #lefts]
diff --git a/stdlib/source/library/lux/data/format/css/font.lux b/stdlib/source/library/lux/data/format/css/font.lux
index c153ec0b8..9856d19e4 100644
--- a/stdlib/source/library/lux/data/format/css/font.lux
+++ b/stdlib/source/library/lux/data/format/css/font.lux
@@ -11,16 +11,16 @@
[world
[net (#+ URL)]]]]
["." // #_
- ["#." value (#+ Value Font-Stretch Font-Style Font-Weight)]])
+ ["#." value (#+ Value Font_Stretch Font_Style Font_Weight)]])
-(type: #export Unicode-Range
+(type: #export Unicode_Range
{#start Nat
#end Nat})
(type: #export Font
{#family Text
#source URL
- #stretch (Maybe (Value Font-Stretch))
- #style (Maybe (Value Font-Style))
- #weight (Maybe (Value Font-Weight))
- #unicode-range (Maybe Unicode-Range)})
+ #stretch (Maybe (Value Font_Stretch))
+ #style (Maybe (Value Font_Style))
+ #weight (Maybe (Value Font_Weight))
+ #unicode_range (Maybe Unicode_Range)})
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 85a775440..1b69f1496 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -1155,13 +1155,13 @@
(def: #export (font_family options)
(-> (List Font) (Value Font))
(case options
- (#.Cons _)
+ (#.Item _)
(|> options
(list\map ..font_name)
(text.join_with ",")
(:abstraction Value))
- #.Nil
+ #.End
..initial))])
(def: #export font_size
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 6cd460f9d..a96a6df84 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -210,7 +210,7 @@
(def: #export (image source attributes)
(-> URL Attributes Image)
(|> attributes
- (#.Cons ["src" source])
+ (#.Item ["src" source])
(..simple "img")))
(def: #export (svg attributes content)
@@ -292,10 +292,10 @@
($_ ..and
for
(case (list\map (product.uncurry ..area) areas)
- #.Nil
+ #.End
(..empty "map" attributes)
- (#.Cons head tail)
+ (#.Item head tail)
(..tag "map" attributes
(list\fold (function.flip ..and) head tail)))))
@@ -457,10 +457,10 @@
(..term term)
(..description description)))
descriptions)
- #.Nil
+ #.End
(..empty "dl" attributes)
- (#.Cons head tail)
+ (#.Item head tail)
(..tag "dl" attributes
(list\fold (function.flip ..and) head tail))))
@@ -515,10 +515,10 @@
(-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element)
(let [head (..table_head (..table_row headers))
content (case (list\map table_row rows)
- #.Nil
+ #.End
head
- (#.Cons first rest)
+ (#.Item first rest)
(..and head
(..table_body
(list\fold (function.flip ..and) first rest))))
diff --git a/stdlib/source/library/lux/data/maybe.lux b/stdlib/source/library/lux/data/maybe.lux
index d51bfed90..155254f2e 100644
--- a/stdlib/source/library/lux/data/maybe.lux
+++ b/stdlib/source/library/lux/data/maybe.lux
@@ -145,7 +145,7 @@
(All [a] (-> (Maybe a) (List a)))
(case value
#.None
- #.Nil
+ #.End
(#.Some value)
- (#.Cons value #.Nil)))
+ (#.Item value #.End)))
diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux
index 7a439fc54..2f0fddee9 100644
--- a/stdlib/source/library/lux/data/sum.lux
+++ b/stdlib/source/library/lux/data/sum.lux
@@ -36,13 +36,13 @@
[(def: #export (<name> es)
(All [a b] (-> (List (| a b)) (List <side>)))
(case es
- #.Nil
- #.Nil
+ #.End
+ #.End
- (#.Cons (0 <right?> x) es')
- (#.Cons [x (<name> es')])
+ (#.Item (0 <right?> x) es')
+ (#.Item [x (<name> es')])
- (#.Cons _ es')
+ (#.Item _ es')
(<name> es')))]
[lefts a #0]
@@ -52,14 +52,14 @@
(def: #export (partition xs)
(All [a b] (-> (List (| a b)) [(List a) (List b)]))
(case xs
- #.Nil
- [#.Nil #.Nil]
+ #.End
+ [#.End #.End]
- (#.Cons x xs')
+ (#.Item x xs')
(let [[lefts rights] (partition xs')]
(case x
- (0 #0 x') [(#.Cons x' lefts) rights]
- (0 #1 x') [lefts (#.Cons x' rights)]))))
+ (0 #0 x') [(#.Item x' lefts) rights]
+ (0 #1 x') [lefts (#.Item x' rights)]))))
(def: #export (equivalence left right)
(All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r))))
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 15dd8ec04..1ab453032 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -181,12 +181,12 @@
(case (..split_with token input)
(#.Some [pre post])
(|> output
- (#.Cons pre)
+ (#.Item pre)
(recur post))
#.None
(|> output
- (#.Cons input)
+ (#.Item input)
list.reverse))))
(def: #export (replace_once pattern replacement template)