aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/collection/sequence.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/collection/sequence.lux')
-rw-r--r--stdlib/source/library/lux/data/collection/sequence.lux30
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux
index 44755f0db..98869531f 100644
--- a/stdlib/source/library/lux/data/collection/sequence.lux
+++ b/stdlib/source/library/lux/data/collection/sequence.lux
@@ -19,23 +19,23 @@
[number
["n" nat]]]]])
-(type: #export (Sequence a)
+(type: .public (Sequence a)
{#.doc "An infinite sequence of values."}
(Cont [a (Sequence a)]))
-(def: #export (iterations f x)
+(def: .public (iterations f x)
{#.doc "Create a sequence by applying a function to a value, and to its result, on and on..."}
(All [a]
(-> (-> a a) a (Sequence a)))
(//.pending [x (iterations f (f x))]))
-(def: #export (repeat x)
+(def: .public (repeat x)
{#.doc "Repeat a value forever."}
(All [a]
(-> a (Sequence a)))
(//.pending [x (repeat x)]))
-(def: #export (cycle [start next])
+(def: .public (cycle [start next])
{#.doc (doc "Go over the elements of a list forever."
"The list should not be empty.")}
(All [a]
@@ -50,7 +50,7 @@
(recur head' tail'))])))
(template [<name> <return>]
- [(def: #export (<name> sequence)
+ [(def: .public (<name> sequence)
(All [a] (-> (Sequence a) <return>))
(let [[head tail] (//.run sequence)]
<name>))]
@@ -59,7 +59,7 @@
[tail (Sequence a)]
)
-(def: #export (item idx sequence)
+(def: .public (item idx sequence)
(All [a] (-> Nat (Sequence a) a))
(let [[head tail] (//.run sequence)]
(case idx
@@ -67,7 +67,7 @@
_ (item (dec idx) tail))))
(template [<taker> <dropper> <splitter> <pred_type> <pred_test> <pred_step>]
- [(def: #export (<taker> pred xs)
+ [(def: .public (<taker> pred xs)
(All [a]
(-> <pred_type> (Sequence a) (List a)))
(let [[x xs'] (//.run xs)]
@@ -75,7 +75,7 @@
(list& x (<taker> <pred_step> xs'))
(list))))
- (def: #export (<dropper> pred xs)
+ (def: .public (<dropper> pred xs)
(All [a]
(-> <pred_type> (Sequence a) (Sequence a)))
(let [[x xs'] (//.run xs)]
@@ -83,7 +83,7 @@
(<dropper> <pred_step> xs')
xs)))
- (def: #export (<splitter> pred xs)
+ (def: .public (<splitter> pred xs)
(All [a]
(-> <pred_type> (Sequence a) [(List a) (Sequence a)]))
(let [[x xs'] (//.run xs)]
@@ -96,14 +96,14 @@
[take drop split Nat (n.> 0 pred) (dec pred)]
)
-(def: #export (unfold step init)
+(def: .public (unfold step init)
{#.doc "A stateful way of infinitely calculating the values of a sequence."}
(All [a b]
(-> (-> a [a b]) a (Sequence b)))
(let [[next x] (step init)]
(//.pending [x (unfold step next)])))
-(def: #export (only predicate sequence)
+(def: .public (only predicate sequence)
{#.doc (doc "A new sequence only with items that satisfy the predicate.")}
(All [a] (-> (-> a Bit) (Sequence a) (Sequence a)))
(let [[head tail] (//.run sequence)]
@@ -111,7 +111,7 @@
(//.pending [head (only predicate tail)])
(only predicate tail))))
-(def: #export (partition left? xs)
+(def: .public (partition left? xs)
{#.doc (doc "Split a sequence in two based on a predicate."
"The left side contains all entries for which the predicate is #1."
"The right side contains all entries for which the predicate is #0.")}
@@ -119,14 +119,14 @@
[(..only left? xs)
(..only (bit.complement left?) xs)])
-(implementation: #export functor
+(implementation: .public functor
(Functor Sequence)
(def: (map f fa)
(let [[head tail] (//.run fa)]
(//.pending [(f head) (map f tail)]))))
-(implementation: #export comonad
+(implementation: .public comonad
(CoMonad Sequence)
(def: &functor ..functor)
@@ -137,7 +137,7 @@
(let [[head tail] (//.run wa)]
(//.pending [wa (split tail)]))))
-(syntax: #export (^sequence& {patterns (<code>.form (<>.many <code>.any))}
+(syntax: .public (^sequence& {patterns (<code>.form (<>.many <code>.any))}
body
{branches (<>.some <code>.any)})
{#.doc (doc "Allows destructuring of sequences in pattern-matching expressions."