diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-10 17:23:34 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-10 17:23:34 +0200 |
commit | e028543baa552aa091fe3485b03da48d25ab8179 (patch) | |
tree | 89d481c7509d3634bce76e9319cb192c2b25a328 /module/srfi/srfi-41 | |
parent | HTML work. (diff) | |
download | calp-e028543baa552aa091fe3485b03da48d25ab8179.tar.gz calp-e028543baa552aa091fe3485b03da48d25ab8179.tar.xz |
Really start breaking apart HTML.
Diffstat (limited to '')
-rw-r--r-- | module/srfi/srfi-41/util.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/module/srfi/srfi-41/util.scm b/module/srfi/srfi-41/util.scm index 51671985..eda379a7 100644 --- a/module/srfi/srfi-41/util.scm +++ b/module/srfi/srfi-41/util.scm @@ -77,6 +77,18 @@ (define-public (stream->values stream) (apply values (stream->list stream))) + +;; Natural numbers from 1 and up, each number repeated 7 times. +(define-public (repeating-naturals from repeats) + (stream-unfold + cdr ; map + (const #t) ; continue? + (lambda (x) ; gen next + (if (= (1- repeats) (car x)) + (cons 0 (1+ (cdr x))) + (cons (1+ (car x)) (cdr x)))) + (cons 0 from))) + ;; Returns two values. A stream of all the elements in stream ;; which satisfiy @var{pred}, and a stream of those elements ;; that don't. @var{pred} is called once per value in the |