Outdated egg!
This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
- Outdated egg!
- Introduction
- Usage
- Documentation
- Primitive
- Derived
- stream-of
- define-stream
- stream
- stream-let
- stream-match
- list->stream
- port->stream
- stream->list
- stream-append
- stream-concat
- stream-drop
- stream-drop-while
- stream-filter
- stream-fold
- stream-for-each
- stream-map
- stream-from
- stream-iterate
- stream-length
- stream-range
- stream-ref
- stream-reverse
- stream-scan
- stream-take
- stream-take-while
- stream-unfold
- stream-unfolds
- stream-zip
- Utilities
- stream-intersperse
- stream-permutations
- file->stream
- stream-split
- stream-unique
- stream-fold-one
- stream-member
- stream-merge
- stream-partition
- stream-finds
- stream-find
- stream-remove
- stream-every
- stream-any
- stream-and
- stream-or
- stream-fold-right
- stream-fold-right-one
- stream-assoc
- stream-equal?
- stream-quick-sort
- stream-insertion-sort
- stream-merge-sort
- stream-maximum
- stream-minimum
- Math Utilities
- Examples
- Author
- License
- Version history
Introduction
SRFI-41 for Chicken Scheme.
Usage
(require-extension srfi-41)
Documentation
See the SRFI-41 Document.
Primitive
stream?
[procedure] (stream? OBJECT)
stream-pair?
[procedure] (stream-pair? OBJECT)
stream-null?
[procedure] (stream-null? OBJECT)
stream-null
[stream] stream-null
stream-cons
[syntax] (stream-cons OBJECT STREAM)
stream-lambda
[syntax] (stream-lambda FORMALS BODY ...)
stream-car
[procedure] (stream-car STREAM)
stream-cdr
[procedure] (stream-cdr STREAM)
Derived
stream-of
[syntax] (stream-of EXPRESSION (VARIABLE in STREAM)/(VARIABLE is EXPRESSION)/PREDICATE ...)
define-stream
[syntax] (define-stream (NAME [FORMAL ...]) BODY ...)
stream
[syntax] (stream) stream-null)
stream-let
[syntax] (stream-let TAG ((NAME VALUE) ...) BODY ...)
stream-match
[syntax] (stream-match STREAM-EXPRESSION CLAUSE ...)
list->stream
[procedure] (list->stream LIST)
port->stream
[procedure] (port->stream [PORT (current-input-port)])
stream->list
[procedure] (stream->list [COUNT #f] STREAM)
stream-append
[procedure] (stream-append STREAM ...)
stream-concat
[procedure] (stream-concat STREAMS)
stream-drop
[procedure] (stream-drop N STREAM)
stream-drop-while
[procedure] (stream-drop-while PREDICATE STREAM)
stream-filter
[procedure] (stream-filter PREDICATE STREAM)
stream-fold
[procedure] (stream-fold PROCEDURE BASE STREAM)
stream-for-each
[procedure] (stream-for-each PROCEDURE STREAM ...)
stream-map
[procedure] (stream-map PROCEDURE STREAM ...)
stream-from
[procedure] (stream-from FIRST [STEP 1])
stream-iterate
[procedure] (stream-iterate PROCEDURE BASE)
stream-length
[procedure] (stream-length STREAM)
stream-range
[procedure] (stream-range FIRST PAST [STEP (if (< FIRST PAST) 1 -1)])
stream-ref
[procedure] (stream-ref STREAM INDEX)
stream-reverse
[procedure] (stream-reverse STREAM)
stream-scan
[procedure] (stream-scan PROCEDURE BASE STREAM)
stream-take
[procedure] (stream-take N STREAM)
stream-take-while
[procedure] (stream-take-while PREDICATE STREAM)
stream-unfold
[procedure] (stream-unfold MAPPER PREDICATE GENERATOR BASE)
stream-unfolds
[procedure] (stream-unfolds GENERATOR SEED)
stream-zip
[procedure] (stream-zip STREAM ...)
Utilities
(require-extension srfi-41-utils)
stream-intersperse
[stream] (stream-intersperse STREAM OBJECT)
stream-permutations
[stream] (stream-permutations STREAM)
file->stream
[stream] (file->stream FILENAME [READ-PROCEDURE read-char])
stream-split
[procedure] (stream-split N STREAM)
stream-unique
[stream] (stream-unique EQUIVALENCE STREAM)
stream-fold-one
[procedure] (stream-fold-one FUNCTION STREAM)
stream-member
[stream] (stream-member EQUIVALENCE OBJECT STREAM)
stream-merge
[stream] (stream-merge LESS-THAN STREAM ...)
stream-partition
[procedure] (stream-partition PREDICATE STREAM)
stream-finds
[stream] (stream-finds EQUIVALENCE OBJECT STREAM)
stream-find
[procedure] (stream-find EQUIVALENCE OBJECT STREAM)
stream-remove
[stream] (stream-remove PREDICATE STREAM)
stream-every
[procedure] (stream-every PREDICATE STREAM)
stream-any
[procedure] (stream-any PREDICATE STREAM)
stream-and
[procedure] (stream-and STREAM)
stream-or
[procedure] (stream-or STREAM)
stream-fold-right
[procedure] (stream-fold-right FUNCTION BASE STREAM)
stream-fold-right-one
[procedure] (stream-fold-right-one FUNCTION STREAM)
stream-assoc
[procedure] (stream-assoc KEY STREAM)
stream-equal?
[procedure] (stream-equal? EQUIVALENCE STREAM1 STREAM2)
stream-quick-sort
[stream] (stream-quick-sort LESS-THAN STREAM)
stream-insertion-sort
[stream] (stream-insertion-sort LESS-THAN STREAM)
stream-merge-sort
[stream] (stream-merge-sort LESS-THAN STREAM)
stream-maximum
[procedure] (stream-maximum LESS-THAN STREAM)
stream-minimum
[procedure] (stream-minimum LESS-THAN STREAM)
Math Utilities
(require-extension srfi-41-math)
stream-sum
[stream] stream-sum
stream-max
[procedure] (stream-max STREAM)
stream-min
[procedure] (stream-min STREAM)
odd-numbers-stream
[stream] odd-numbers-stream
even-numbers-stream
[stream] even-numbers-stream
natural-numbers-stream
[stream] natural-numbers-stream
prime-numbers-stream
[stream] prime-numbers-stream
hamming-sequence-stream
[stream] hamming-sequence-stream
Examples
(define (sigma FUNCTION m n) (stream-fold + 0 (stream-map FUNCTION (stream-range m (+ n 1))))) (define (factorial n) (stream-ref (stream-scan * 1 (stream-from 1))) n) (define odd-numbers-stream (stream-from 1 2)) (define even-numbers-stream (stream-from 0 2)) (define natural-numbers-stream (stream-iterate add1 0)) (define prime-numbers-stream (let () (define-stream (next base mult STREAM) (let ((first (stream-car STREAM)) (rest (stream-cdr STREAM))) (cond ((< first mult) (stream-cons first (next base mult rest))) ((< mult first) (next base (+ base mult) STREAM)) (else (next base (+ base mult) rest))))) (define-stream (sift base STREAM) (next base (+ base base) STREAM)) (define-stream (sieve STREAM) (let ((first (stream-car STREAM)) (rest (stream-cdr STREAM))) (stream-cons first (sieve (sift first rest))))) (sieve (stream-from 2)))) ;; http://www.research.att.com/~njas/sequences/A051037 (define hamming-sequence-stream (stream-cons 1 (stream-unique = (stream-merge < (stream-map (left-section * 2) hamming-sequence-stream) (stream-map (left-section * 3) hamming-sequence-stream) (stream-map (left-section * 5) hamming-sequence-stream)))))
Author
Philip L. Bewig
Chicken Port: Kon Lovett
License
Copyright (C) 2007 by Philip L. Bewig of Saint Louis, Missouri, USA. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version history
- 1.0
- Release