srfi-41
SRFI 41 for Chicken Scheme.
- srfi-41
- Documentation
- Usage
- 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
- Repository
- Version history
- License
Documentation
See the SRFI-41 Document.
Usage
The exports of streams-primitive and streams-derived are povided by:
(import srfi-41) ;Or (a synonym) (import streams)
Primitive
Usage
(import (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
(import (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
(import (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
(import (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
(import srfi-41) (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))
Requirements
Author
Philip L. Bewig
Repository
This egg is hosted on the CHICKEN Subversion repository:
https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/srfi-41
If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.
Version history
- 2.1.5
- Apply Chris Jester-Young's 2015 stream-constant speedup.
- 2.1.4
- Add multiple value result for stream-match.
- 2.1.3
- .
- 2.1.2
- .
- 2.1.1
- .
- 2.1.0
- Add (streams derived) style module naming.
- 2.0.4
- .
- 2.0.0
- CHICKEN 5 release.
License
Copyright (C) 2023 Kon Lovett. Copyright (C) 2007 by Philip L. Bewig of Saint Louis, Missouri, USA.
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.