aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-04-06 00:35:05 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-04-06 00:35:05 +0200
commit4facf89f2906b21cf35524c9bb06f6f1446b9960 (patch)
treef15a11c782499af91913c8514d1f568376e1f98d /doc
parentUse existing filename if exists. (diff)
downloadcalp-4facf89f2906b21cf35524c9bb06f6f1446b9960.tar.gz
calp-4facf89f2906b21cf35524c9bb06f6f1446b9960.tar.xz
Document part of srfi-41 utils.
Diffstat (limited to 'doc')
-rw-r--r--doc/ref/guile.texi1
-rw-r--r--doc/ref/guile/srfi-41.texi80
2 files changed, 81 insertions, 0 deletions
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index 72f79ed0..eb9e3bcc 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -2,6 +2,7 @@
@chapter Guile
@include guile/datetime.texi
+@include guile/srfi-41.texi
@include guile/util.texi
@include guile/util-path.texi
@include guile/util-config.texi
diff --git a/doc/ref/guile/srfi-41.texi b/doc/ref/guile/srfi-41.texi
new file mode 100644
index 00000000..8c65b6eb
--- /dev/null
+++ b/doc/ref/guile/srfi-41.texi
@@ -0,0 +1,80 @@
+@node SRFI 41 Utilities
+@section SRFI 41 Utilities
+
+Extra utilities for handling streams. Provided by @code{(srfi srfi-41
+util)}.
+
+@defun stream-car+cdr stream
+Returns the car and cdr of stream.
+@end defun
+
+@defun interleave-streams < streams
+Merges a number of totally ordered streams into a single
+totally ordered stream.
+
+((≺, stream)) → (≺, stream)
+@end defun
+
+@defun stream-insert < item stream
+Insert item in the totally ordered stream (≺, stream).
+@end defun
+
+
+@defun filter-sorted-stream pred stream
+@end defun
+
+
+@defun filter-sorted-stream* pred keep-remaining? stream
+@end defun
+
+@defun get-stream-interval start-pred end-pred stream
+Get the substream from stream from the first match of start-pred, to
+the first match of end-pred after start-pred.
+@end defun
+
+
+@defun stream-find pred stream
+Find the first element in stream satisfying the predicate, or #f none
+was found.
+@end defun
+
+
+@defun stream-remave pred stream
+Stream-filter, but with predicate negated.
+@end defun
+
+
+@defun stream->values stream
+Equivalent to list->values. Returns as many objects as the stream is long.
+@end defun
+
+
+@defun repeating-naturals from repeats
+Natural numbers from @var{from} and up, but each repeated @var{repeat}
+times.
+@example
+(stream->list 15 (repeating-naturals 1 3))
+⇒ (1 1 1 2 2 2 3 3 3 4 4 4 5 5 5)
+@end example
+@end defun
+
+
+@defun stream-partition pred stream
+@end defun
+
+@defun stream-split idx stream
+@end defun
+
+@defun stream-paginate stream [page-size=10]
+@end defun
+
+
+@defun eager-stream-cons a b
+stream cons, but eval arguments beforehand.
+@end defun
+
+@defun stream-timeslice-limit stream timeslice
+Wrap a stream in time limits. Each element has at most @var{timeslice}
+seconds to produce a value, otherwise the stream ends. Useful for finding the
+``final'' element matching a predicate in an infinite stream.
+@end defun