Streams is a library to facilitate the use of collections in a way that simulates lazy evaluation. This allows for powerfully concise code for dynamically building potentially indefinitely large collections. For example, one can construct the Fibonacci sequence in “one” line as follows:
from operator import add
from streams import SinglyLinkedStream as Stream
fib = Stream(0, lambda: Stream(1, lambda: Stream.map(add, fib, fib.next)))
If an abstract data type can be implemented via nodes, then it can be implemented via stream nodes.
One of the things that makes streams so capable is their ability to be traversed multiple times without changing their internal structure. This is unlike iterators which discard data as one iterates through them.
If you're unsure of which class to use, you probably want
SinglyLinkedStream
. For the sake of brevity, you might want to create
an alias for the class (e.g. Stream = SinglyLinkedStream
).
To do
The documentation can be found at https://pystreams.readthedocs.io/. If you
prefer to view the documentation locally, you can build it from the source. To
build the documentation to HTML, navigate to the “docs/” directory and execute
the command make html
. The home page of the documentation will be at
“docs/build/html/index.html”. For a full list of possible formats in which the
documentation can be built, see “docs/Makefile” (or “docs/make.bat”).
The code conventions used throughout this project can be found in PEP 8 and PEP 257. Before submitting a pull request, please be sure that it corresponds to an issue. If no such issue exists, then please create one.
This project is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.