aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/collection/stream.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/documentation/lux/data/collection/stream.lux')
-rw-r--r--stdlib/source/documentation/lux/data/collection/stream.lux76
1 files changed, 76 insertions, 0 deletions
diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux
new file mode 100644
index 000000000..9486be114
--- /dev/null
+++ b/stdlib/source/documentation/lux/data/collection/stream.lux
@@ -0,0 +1,76 @@
+(.module:
+ [library
+ [lux {"-" list}
+ ["$" documentation {"+" documentation:}]
+ [control
+ ["<>" parser
+ ["<[0]>" code]]]
+ [data
+ ["[0]" text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
+
+(documentation: (/.Stream it)
+ "An infinite sequence of values.")
+
+(documentation: /.iterations
+ "A stateful way of infinitely calculating the values of a stream."
+ [(iterations step init)])
+
+(documentation: /.repeated
+ "Repeat a value forever."
+ [(repeated x)])
+
+(documentation: /.cycle
+ "Go over the elements of a list forever."
+ [(cycle [start next])])
+
+(documentation: /.item
+ ""
+ [(item idx stream)])
+
+(documentation: /.only
+ "A new stream only with items that satisfy the predicate."
+ [(only predicate stream)])
+
+(documentation: /.partition
+ (format "Split a stream in two based on a predicate."
+ \n "The left side contains all entries for which the predicate is #1."
+ \n "The right side contains all entries for which the predicate is #0.")
+ [(partition left? xs)])
+
+(documentation: /.^stream&
+ (format "Allows destructuring of streams in pattern-matching expressions."
+ \n "Caveat emptor: Only use it for destructuring, and not for testing values within the streams.")
+ [(let [(^stream& x y z _tail) (some_stream_func +1 +2 +3)]
+ (func x y z))])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Stream
+ ..iterations
+ ..repeated
+ ..cycle
+ ..item
+
+ ..only
+ ..partition
+ ..^stream&
+ ($.default /.head)
+ ($.default /.tail)
+ ($.default /.functor)
+ ($.default /.comonad)
+ ($.default /.while)
+ ($.default /.until)
+ ($.default /.first)
+ ($.default /.after)
+ ($.default /.split_when)
+ ($.default /.split_at)]
+ []))