Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 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.
srfi-41
SRFI 41 for Chicken Scheme.
- Outdated egg!
- srfi-41
- Documentation
- Primitive
- Derived
- Usage
- define-stream
- stream-of
- stream-let
- stream-match
- stream
- 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-unfold
- stream-unfolds
- stream-zip
- Utilities
- Usage
- 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
- binary-tree-same-fringe?
- Math Utilities
- Examples
- Requirements
- Author
- Version history
- License
Documentation
See the SRFI-41 Document.
Primitive
Usage
(require-extension streams-primitive)
stream?
[procedure] (stream? OBJECT) => booleanstream-pair?
[procedure] (stream-pair? OBJECT) => booleanstream-null?
[procedure] (stream-null? OBJECT) => booleanstream-occupied?
[procedure] (stream-occupied? OBJECT) => booleanInverse of stream-null?.
stream-null
[constant] stream-nullThe null stream value.
stream-cons
[syntax] (stream-cons OBJECT STREAM) => streamstream-lambda
[syntax] (stream-lambda FORMALS BODY ...) => procedurestream-car
[procedure] (stream-car STREAM) => *stream-cdr
[procedure] (stream-cdr STREAM) => streamDerived
Usage
(require-extension streams-derived)
define-stream
[syntax] (define-stream (NAME [FORMAL...]) BODY...)stream-of
[syntax] (stream-of EXPRESSION (VARIABLE in STREAM)/(VARIABLE is EXPRESSION)/PREDICATE ...) => streamstream-let
[syntax] (stream-let TAG ((NAME VALUE)...) BODY...)stream-match
[syntax] (stream-match STREAM-EXPRESSION CLAUSE...)stream
[syntax] (stream OBJECT...) => streamlist->stream
[procedure] (list->stream LIST) => streamport->stream
[procedure] (port->stream [PORT (current-input-port)]) => streamstream->list
[procedure] (stream->list [COUNT #f] STREAM) => liststream-append
[procedure] (stream-append STREAM...) => streamstream-concat
[procedure] (stream-concat STREAM) => streamFlatten a stream of streams.
stream-drop
[procedure] (stream-drop COUNT STREAM) => streamstream-drop-while
[procedure] (stream-drop-while PREDICATE STREAM) => streamstream-filter
[procedure] (stream-filter PREDICATE STREAM) => streamstream-fold
[procedure] (stream-fold FUNCTION BASE STREAM...) => *stream-for-each
[procedure] (stream-for-each FUNCTION STREAM...) => streamstream-map
[procedure] (stream-map FUNCTION STREAM...) => streamstream-from
[procedure] (stream-from FIRST [STEP 1]) => streamstream-iterate
[procedure] (stream-iterate FUNCTION BASE) => streamstream-length
[procedure] (stream-length STREAM) => FIXNUMstream-range
[procedure] (stream-range FIRST PAST [STEP (if (< FIRST PAST) 1 -1)]) => streamstream-ref
[procedure] (stream-ref STREAM INDEX) => *stream-reverse
[procedure] (stream-reverse STREAM) => streamstream-scan
[procedure] (stream-scan FUNCTION BASE STREAM) => streamstream-unfold
[procedure] (stream-unfold MAPPER PREDICATE GENERATOR BASE) => streamstream-unfolds
[procedure] (stream-unfolds GENERATOR SEED) => streamstream-zip
[procedure] (stream-zip STREAM...) => streamUtilities
Usage
(require-extension streams-utils)
stream-intersperse
[procedure] (stream-intersperse STREAM OBJECT) => streamstream-permutations
[procedure] (stream-permutations STREAM) => streamfile->stream
[procedure] (file->stream FILENAME [READER read-char]) => streamstream-split
[procedure] (stream-split COUNT STREAM) => (values STREAM STREAM)stream-unique
[procedure] (stream-unique =? STREAM) => streamstream-fold-one
[procedure] (stream-fold-one FUNCTION STREAM) => streamstream-member
[procedure] (stream-member =? OBJECT STREAM) => streamstream-merge
[procedure] (stream-merge <? STREAM ...) => streamstream-partition
[procedure] (stream-partition PREDICATE STREAM) => streamstream-finds
[procedure] (stream-finds =? OBJECT STREAM) => streamstream-find
[procedure] (stream-find =? OBJECT STREAM) => streamstream-remove
[procedure] (stream-remove PREDICATE STREAM) => streamstream-every
[procedure] (stream-every PREDICATE STREAM) => booleanstream-any
[procedure] (stream-any PREDICATE STREAM) => booleanstream-and
[procedure] (stream-and STREAM) => booleanstream-or
[procedure] (stream-or STREAM) => booleanstream-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 [=? equal?]) => *stream-equal?
[procedure] (stream-equal? =? STREAM1 STREAM2) => booleanstream-quick-sort
[procedure] (stream-quick-sort <? STREAM) => streamstream-insertion-sort
[procedure] (stream-insertion-sort <? STREAM) => streamstream-merge-sort
[procedure] (stream-merge-sort <? STREAM) => streamstream-maximum
[procedure] (stream-maximum <? STREAM) => *stream-minimum
[procedure] (stream-minimum <? STREAM) => *binary-tree-same-fringe?
[procedure] (binary-tree-same-fringe? TREE1 TREE2) => booleanTREE1 and TREE2 are binary-tree nodes, so either () or pair.
Lazy version of the same fringe.
Math Utilities
Usage
(require-extension streams-math)
stream-max
[procedure] (stream-max STREAM) => *stream-min
[procedure] (stream-min STREAM) => *stream-sum
[constant] stream-sumodd-numbers-stream
[constant] odd-numbers-streameven-numbers-stream
[constant] even-numbers-streamcardinal-numbers-stream
[constant] cardinal-numbers-streamnatural-numbers-stream
[constant] natural-numbers-streamprime-numbers-stream
[constant] prime-numbers-streamhamming-sequence-stream
[constant] hamming-sequence-streamExamples
(use streams) (define (sigma function m n) (stream-fold + 0 (stream-map function (stream-range m (add1 n))))) (define (factorial n) (stream-ref (stream-scan * 1 (stream-from 1)) n))
Usage
The exports of streams-primitive and streams-derived are povided by:
(require-extension streams)
Or (a synonym)
(require-extension srfi-41)
Requirements
check-errors combinators record-variants
Author
Philip L. Bewig
Version history
- 1.2.4
- Included inline-type-checks.scm so all includes are egg-local.
- 1.2.3
- 1.2.2
- Check for stream type when forcing; reported by Jim Ursetto. Faster prime number stream; thanks to Matthias Bauer.
- 1.2.1
- 1.2.0
- Use of record-variants & combinators.
- 1.1.0
- Added "srfi-41" modules as synonynom of "streams".
- 1.0.2
- Bug fix for problem w/ use of 'obj' in "streams-utils" reported by Josh Griffith. Better error message for nary stream procedures.
- 1.0.1
- Updated test.
- 1.0.0
- Chicken 4 release.
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 "AS IS", 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.
Copyright (C) 2009 Kon Lovett. 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.