https://github.com/insolor/zig-itertools
WIP. Implementation of some useful iterators in Zig. Inspired by Python's itertools module.
https://github.com/insolor/zig-itertools
zig zig-library zigang
Last synced: 10 months ago
JSON representation
WIP. Implementation of some useful iterators in Zig. Inspired by Python's itertools module.
- Host: GitHub
- URL: https://github.com/insolor/zig-itertools
- Owner: insolor
- Created: 2025-07-27T10:13:39.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-27T11:02:15.000Z (11 months ago)
- Last Synced: 2025-07-27T13:04:43.725Z (11 months ago)
- Topics: zig, zig-library, zigang
- Language: Zig
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Zig Itertools
[](https://github.com/ziglang/zig)
[](https://github.com/insolor/zig-collections/actions/workflows/zig-build-test.yml)
> [!WARNING]
> WORK IN PROGRESS
Implementation of some useful data structures in Zig. Inspired by Python's [`itertools`](https://docs.python.org/3/library/itertools.html) module.
Implemented so far:
- `ChainIterator` - "glues" two iterator in one, returns their elements in succession
- `SliceIterator` - iterates over a slice
- `EmptyIterator` - emits no elements. Implemented only for testing purposes.
## Installation
1. In the root directory of your project, run the following command to add `zig_itertools` to your `build.zig.zon` file (replace 0.0.1 with the latest release number):
```bash
zig fetch --save https://github.com/insolor/zig-itertools/archive/refs/tags/0.0.1.zip
```
Replace `main` in the URL with the tag you want to use.
2. Add zig_itertools as a dependency module in your `build.zig` file, example:
```zig
const zig_itertools = b.dependency("zig_itertools", .{});
exe.root_module.addImport("zig_itertools", zig_itertools.module("zig_itertools"));
```
After that, you'll be able to import `zig_itertools` namespace from your code:
```zig
const zig_itertools = @import("zig_itertools");
const ChainIterator = zig_itertools.ChainIterator;
```